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
Thrown by the bigtablesql Tool.ValidateSource when the sources.Source passed to the tool does not implement the compatibleSource interface expected by this tool. It catches wiring a tool to a source of the wrong kind at runtime before any query executes.
Source
Thrown at internal/tools/bigtable/bigtablesql/bigtablesql.go:106
// 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
- Set the tool's source field to a bigtable source kind in tools.yaml
- Verify the referenced source name exists and its kind initializes as a Bigtable-compatible source
- Rebuild/restart the toolbox so the new source-tool pairing is loaded
- If calling Invoke programmatically, pass the Source returned by the bigtable source's Initialize, not another source
Example fix
// before (tools.yaml)
sources:
my-db:
kind: postgres
uri: ...
tools:
execute-sql:
kind: bigtable-sql
source: my-db
// after
sources:
my-bigtable:
kind: bigtable
project: my-project
instance: my-instance
tools:
execute-sql:
kind: bigtable-sql
source: my-bigtable Defensive patterns
Strategy: type-guard
Validate before calling
// Before wiring the tool, assert the source implements the tool's interface
var _ sources.Source = mySource
if _, ok := mySource.(bigtablesql.CompatibleSource); !ok {
return fmt.Errorf("source %s is not compatible with bigtable-sql", sourceName)
} Type guard
func isCompatibleBigtableSQLSource(s sources.Source) (bigtablesql.CompatibleSource, bool) {
cs, ok := s.(bigtablesql.CompatibleSource)
return cs, ok
} Prevention
- Keep the tool's source field pointing at a source of the matching kind (bigtable)
- After renaming sources, grep tools.yaml for stale source references
- Validate the full config at startup; the toolbox validates source-tool pairs before serving
- Do not copy tool blocks across sources of different kinds without updating source
When it happens
Trigger: Invoke/ValidateSource is called with a source whose concrete type does not satisfy bigtablesql's compatibleSource interface — e.g. the tool's source field points at a Postgres or non-Bigtable source in tools.yaml, or code passes the wrong Source into Invoke.
Common situations: Copy-pasting a tool block and leaving the source key pointing at a different database; renaming sources and forgetting to update the tool; programmatically constructing tool/source pairs mismatched after a config refactor.
Related errors
- source is not compatible with the tool
- source is not compatible with the tool
- source is not compatible with the tool
- source is not compatible with the tool
- source is not compatible with the tool
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/4c2330c6809503b8.
Report an issue: GitHub.