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
ValidateSource type-asserts the resolved source against the tool's compatibleSource interface (Looker API access). The error fires when the tool is bound to a source that is not a Looker source, i.e. the tool kind and source kind in the YAML configuration are incompatible.
Source
Thrown at internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas.go:107
// 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)
}
mapParams := params.AsMap()
conn, ok := mapParams["conn"].(string)
if !ok {
return nil, util.NewAgentError(fmt.Sprintf("'conn' must be a string, got %T", mapParams["conn"]), nil)
}
db, _ := mapParams["db"].(string)
sdk, err := source.GetLookerSDK(ctx, string(accessToken))
if err != nil {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set the tool's `source:` to a Looker source (kind `looker`)
- Implement compatibleSource if a custom source must work with Looker tools
- Cross-check tool-to-source mappings in the config after any rename/refactor
Example fix
// before
tools:
schemas:
kind: looker-get-connection-schemas
source: bq-src
// after
tools:
schemas:
kind: looker-get-connection-schemas
source: looker-src Defensive patterns
Strategy: type-guard
Validate before calling
if err := tool.ValidateSource(src); err != nil {
return fmt.Errorf("source %T incompatible with looker-get-connection-schemas", src)
} Type guard
func isCompatibleLookerSource(s sources.Source) bool {
_, ok := s.(lookergetconnectionschemas.CompatibleSource)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
if strings.Contains(err.Error(), "not a compatible type") {
return errors.New("bind this tool to a looker source")
}
return err
} Prevention
- Validate tool/source pairing at startup
- Search tools.yaml for looker tool kinds and audit their sources
- Update stale source references after renames
When it happens
Trigger: ValidateSource (or the subsequent Invoke) receives a non-Looker source, e.g. because the tools.yaml `source:` field names a source of another kind.
Common situations: Wrong source name in the tool config; renamed sources leaving stale references; custom sources missing compatibleSource methods; passing mocks in tests.
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/79fbbdf9964f8341.
Report an issue: GitHub.