googleapis/mcp-toolbox · error

invalid source for %q tool: source %q is not a compatible ty

Error message

invalid source for %q tool: source %q is not a compatible type

What it means

clickhouse-list-tables.ValidateSource performs the standard compatibility check: it asserts the provided sources.Source implements `compatibleSource` and returns this error for any other source type. It ensures the tool never invokes SQL against a non-ClickHouse source.

Source

Thrown at internal/tools/clickhouse/clickhouselisttables/clickhouselisttables.go:113

var _ tools.Tool = Tool{}

type Tool struct {
	tools.BaseTool[Config]
}

func (t Tool) GetSourceName() string {
	return t.Cfg.Source
}

func (t Tool) ToConfig() tools.ToolConfig {
	return t.Cfg
}

func (t Tool) ValidateSource(source sources.Source) error {
	_, ok := source.(compatibleSource)
	if !ok {
		return fmt.Errorf("invalid source for %q tool: source %q is not a compatible type", t.Cfg.Type, t.Cfg.Source)
	}
	return nil
}

func (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {
	source, ok := s.(compatibleSource)
	if !ok {
		return nil, util.NewClientServerError("source used is not compatible with the tool", http.StatusInternalServerError, nil)
	}
	mapParams := params.AsMap()
	database, ok := mapParams[databaseKey].(string)
	if !ok {
		return nil, util.NewAgentError(fmt.Sprintf("invalid or missing '%s' parameter; expected a string", databaseKey), nil)
	}

	// The database name is interpolated directly into the `SHOW TABLES FROM`
	// statement. Reject anything that is not a plain identifier so that a
	// caller cannot smuggle additional clauses (LIKE, LIMIT, FORMAT,

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Reference a clickhouse-kind source in the tool config.
  2. Confirm the named source exists and initialized with kind clickhouse.
  3. Update custom sources to implement the tool's compatibleSource interface.
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight check before registering
if err := tool.ValidateSource(source); err != nil {
    log.Fatalf("list-tables source mismatch: %v", err)
}

Type guard

func _, isClickhouse := src.(interface{ DB() *sql.DB }); isClickhouse

Prevention

When it happens

Trigger: The tool is bound to a source that is not internal ClickHouse source type — wrong `source:` reference in the YAML config, or a test/mock source failing the assertion.

Common situations: Config authoring mistakes mixing source kinds; moving tool definitions between configs; upgrading the toolbox where a custom source stopped matching the interface.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/f6ecf389f3dd7539. Report an issue: GitHub.