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 asserts that the tool's source implements the looker-compatibleSource interface; any source of a kind other than "looker" fails the assertion and produces this error. It is a startup guard ensuring the tool only runs against a real Looker backend.
Source
Thrown at internal/tools/looker/lookerdevmode/lookerdevmode.go:103
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)
}
mapParams := params.AsMap()
devMode, ok := mapParams["devMode"].(bool)
if !ok {
return nil, util.NewAgentError(fmt.Sprintf("'devMode' must be a boolean, got %T", mapParams["devMode"]), nil)
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Bind the tool to a source with kind "looker"
- Verify the referenced source exists and is looker-typed
- Use a compatibleSource mock when unit testing
Example fix
// before source: my-postgres // after source: my-looker
Defensive patterns
Strategy: type-guard
Validate before calling
if err := tool.ValidateSource(src); err != nil { return 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("tool %s bound to wrong source: %v", name, err) } Prevention
- Run ValidateSource during config load for all looker tools
- Keep one looker source per looker tool set
- Review YAML after renaming/re-typing sources
When it happens
Trigger: Config load where the lookerdevmode tool references a non-looker source; direct calls to ValidateSource with a foreign sources.Source.
Common situations: Wrong source name in YAML; environments where a looker source was replaced by another kind; test code passing dummy sources.
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
- 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/27189d8041302166.
Report an issue: GitHub.