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 verifies at startup that the source bound to this lookerdeleteprojectfile tool implements the looker-compatibleSource interface. If the configured source is any type other than a Looker source, the type assertion fails and this error is returned, preventing the tool from being invoked against an incompatible backend.
Source
Thrown at internal/tools/looker/lookerdeleteprojectfile/lookerdeleteprojectfile.go:108
// 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)
}
sdk, err := source.GetLookerSDK(ctx, string(accessToken))
if err != nil {
return nil, util.NewClientServerError("error getting sdk", http.StatusInternalServerError, err)
}
mapParams := params.AsMap()
projectId, ok := mapParams["project_id"].(string)
if !ok {
return nil, util.NewAgentError(fmt.Sprintf("'project_id' must be a string, got %T", mapParams["project_id"]), nil)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's source field at a source of kind "looker" in the config
- Confirm the referenced source is defined and registered as looker
- If calling programmatically, pass a sources/looker source instance
Example fix
// before
sources:
db: { kind: postgres, ... }
tools:
del-file: { kind: looker-delete-project-file, source: db }
// after
sources:
lk: { kind: looker, ... }
tools:
del-file: { kind: looker-delete-project-file, source: lk } Defensive patterns
Strategy: type-guard
Validate before calling
if err := tool.ValidateSource(src); err != nil { return fmt.Errorf("config invalid: %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("incompatible source: %v", err) } Prevention
- Call ValidateSource once at startup for every tool
- Keep tool `source:` names pointing at looker-kind sources
- Add config tests that load and validate all tool definitions
When it happens
Trigger: Server startup/config validation where the tool's YAML `source:` points to a non-looker source kind; calling ValidateSource directly with a foreign sources.Source.
Common situations: Copy-pasted tool configs referencing the wrong source name; refactors that renamed or re-typed a source; multi-source configs where the tool was pointed at postgres/http instead of looker.
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/3ccea5019f483ae3.
Report an issue: GitHub.