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
The looker-list-gitbranches tool's ValidateSource checks that the supplied sources.Source implements its compatibleSource interface (Looker SDK helpers). A failed type assertion means the tool was bound to a source of the wrong kind, so validation returns this error rather than allowing invocation against an incompatible source.
Source
Thrown at internal/tools/looker/lookerlistgitbranches/lookerlistgitbranches.go:106
// 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(fmt.Sprintf("error getting sdk: %v", err), http.StatusInternalServerError, err)
}
mapParams := params.AsMap()
projectId := mapParams["project_id"].(string)
resp, err := sdk.AllGitBranches(projectId, source.LookerApiSettings())View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's `source` field at a source of kind looker in tools.yaml.
- Confirm the source name matches an existing entry under `sources` with kind looker.
- If using a custom source, implement the full compatibleSource interface.
Example fix
# before
sources:
looker-src:
kind: http
tools:
git-branches:
kind: looker-list-gitbranches
source: looker-src
# after
sources:
looker-src:
kind: looker
# ...looker auth config...
tools:
git-branches:
kind: looker-list-gitbranches
source: looker-src Defensive patterns
Strategy: type-guard
Validate before calling
// Go: validate the source before use
if err := tool.ValidateSource(src); err != nil {
return fmt.Errorf("tool %s bound to incompatible source: %w", tool.Name(), err)
} Type guard
func isLookerSource(s sources.Source) bool {
_, ok := s.(interface {
UseClientAuthorization() bool
GetAuthTokenHeaderName() string
LookerApiSettings() *rtl.ApiSettings
GetLookerSDK(context.Context, string) (*v4.LookerSDK, error)
})
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
if strings.Contains(err.Error(), "not a compatible type") {
return fmt.Errorf("rebind looker-list-gitbranches to a looker-kind source: %w", err)
}
return err
} Prevention
- Pair each looker tool kind with a looker source kind in tools.yaml.
- Call ValidateSource at startup for every tool/source pair.
- After refactors, re-run integration tests that load real configs.
- Avoid sharing one source name across different tool families.
When it happens
Trigger: Calling Tool.ValidateSource(source) where source is not a Looker source — typically because the tool's `source:` references a non-Looker source in tools.yaml, or the wrong Source is passed when composing tools programmatically.
Common situations: Tool config pointing at a database source instead of the looker source; duplicated tool definitions with copy-pasted source names; a custom or upgraded Looker source that dropped a required interface method (GetLookerSDK, LookerApiSettings, etc.).
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/f525017046e040a6.
Report an issue: GitHub.