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
Same family as error 1390: ValidateSource in elasticsearchexecuteesql.go performs a type assertion of the bound source to the private `compatibleSource` interface; a source of any other type fails the assertion and the tool reports that the source is not a compatible type. The elasticsearch-execute-esql tool can only run against an Elasticsearch source.
Source
Thrown at internal/tools/elasticsearch/elasticsearchexecuteesql/elasticsearchexecuteesql.go:100
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()
query, ok := paramsMap["query"].(string)
if !ok {
return nil, util.NewAgentError(fmt.Sprintf("unable to get cast %s", paramsMap["query"]), nil)
}
// Default to json format
format := t.Cfg.Format
if format == "" {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Bind the tool to a source whose kind is `elasticsearch`
- Grep tools.yaml for the source name used by this tool and confirm its `kind`
- If wrapping CloudSQL/other managed Elasticsearch, ensure the correct source type is used
- Restart the toolbox after fixing the config so validation re-runs
Example fix
// before (tools.yaml)
tools:
q:
kind: elasticsearch-execute-esql
source: alloydb-src
// after
tools:
q:
kind: elasticsearch-execute-esql
source: elasticsearch-src Defensive patterns
Strategy: validation
Validate before calling
// Assert source kind matches the tool family before load:
// tool kind `elasticsearch-execute-esql` requires sources.<name>.kind == "elasticsearch"
if src.Kind != "elasticsearch" {
return fmt.Errorf("tool %s requires an elasticsearch source, got %s", toolName, src.Kind)
} Type guard
if _, ok := src.(elasticsearchexecuteesql.CompatibleSource); !ok {
return fmt.Errorf("%T cannot back elasticsearch-execute-esql", src)
} Try / catch
if err := tool.ValidateSource(src); err != nil {
return nil, fmt.Errorf("fix tools.yaml source binding for %s: %w", toolName, err)
} Prevention
- Name sources after their engine to make mismatches obvious in diffs
- Run `toolbox` startup validation in CI pipelines
- Review source references whenever renaming or removing sources
- For managed Elasticsearch-compatible services, confirm the exact supported source kind in docs
When it happens
Trigger: A tool of kind `elasticsearch-execute-esql` whose `source` references a source whose Go implementation does not implement compatibleSource (any non-Elasticsearch source kind).
Common situations: Mistyping the source name in tools.yaml so it resolves to a different source; refactoring a multi-source config and rebinding tools to the wrong source; using a managed-source wrapper that isn't recognized as Elasticsearch-compatible.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/cd3bbc9340bb61c6.
Report an issue: GitHub.