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 for looker-get-dimensions performs `source.(compatibleSource)` to guarantee the bound source can serve Looker LookML queries. A non-Looker source fails the assertion and this error is returned, preventing Invoke from running against an unusable source.
Source
Thrown at internal/tools/looker/lookergetdimensions/lookergetdimensions.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)
}
logger, err := util.LoggerFromContext(ctx)
if err != nil {
return nil, util.NewClientServerError("unable to get logger from ctx", http.StatusInternalServerError, err)
}
model, explore, err := lookercommon.ProcessFieldArgs(ctx, params)
if err != nil {
return nil, util.NewAgentError("error processing model or explore", err)
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set the tool's `source:` to a looker-kind source.
- Fix source name typos so the correct source resolves.
- Implement compatibleSource for custom sources.
- Validate config at startup to catch the mismatch early.
Example fix
// before
kind: looker-get-dimensions
source: bq-prod
// after
kind: looker-get-dimensions
source: looker-prod Defensive patterns
Strategy: type-guard
Validate before calling
if err := tool.ValidateSource(src); err != nil {
return fmt.Errorf("looker-get-dimensions needs a looker source: %w", err)
} Type guard
func isLookerSource(s sources.Source) bool {
_, ok := s.(compatibleSource)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
log.Fatalf("source mismatch for looker tool: %v", err)
} Prevention
- Validate all tool/source bindings at server startup.
- Bind looker-get-dimensions only to looker-kind sources.
- Grep configs for stale source names after renames.
- Implement compatibleSource fully on any custom Looker source.
When it happens
Trigger: Validation or the start of Invoke when the source bound to the looker-get-dimensions tool is a non-Looker kind (Postgres, HTTP, BigQuery, etc.).
Common situations: tools.yaml binds the tool to the wrong source; stale references after source renames; custom Source implementations lacking the Looker interface.
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/adab880b81a89cb4.
Report an issue: GitHub.