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

The oracle-sql tool's ValidateSource requires the bound source to implement its compatibleSource interface (an Oracle database source). Binding any other source type triggers this error naming the tool type and source name, preventing SQL execution against a non-Oracle backend.

Source

Thrown at internal/tools/oracle/oraclesql/oraclesql.go:95

// validate interface
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)
	}
	paramsMap := params.AsMap()
	newStatement, err := parameters.ResolveTemplateParams(t.Cfg.TemplateParameters, t.Cfg.Statement, paramsMap)
	if err != nil {
		return nil, util.NewAgentError("unable to extract template params", err)
	}

	newParams, err := parameters.GetParams(t.Cfg.Parameters, paramsMap)
	if err != nil {
		return nil, util.NewAgentError("unable to extract standard params", err)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's source to an Oracle-based source kind (oracle).
  2. Verify the referenced source exists and its kind is oracle.
  3. Programmatic composition: pass the Oracle source instance to the tool.

Example fix

# before
  run-sql:
    kind: oracle-sql
    source: my-postgres
# after
  run-sql:
    kind: oracle-sql
    source: my-oracle
Defensive patterns

Strategy: type-guard

Validate before calling

if err := tool.ValidateSource(src); err != nil { /* rebind source in tools.yaml */ }

Type guard

func isOracleSource(s sources.Source) bool {
    type oracleSrc interface{ SourceType() string }
    if o, ok := s.(oracleSrc); ok { return o.SourceType() == "oracle" }
    return false
}

Try / catch

if err := t.ValidateSource(src); err != nil {
    return fmt.Errorf("oracle-sql requires an Oracle source: %w", err)
}

Prevention

When it happens

Trigger: A oracle-sql tool in tools.yaml referencing a non-Oracle source (postgres, mysql, mssql, etc.); runtime call with a mismatched sources.Source implementation.

Common situations: Copy-pasting tool definitions and forgetting to update the source; renaming/re-kinding a source without updating tools; name typos that silently resolve to another source.

Related errors


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