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-health-pulse asserts the given sources.Source to compatibleSource and returns this error if the assertion fails. It ensures at validation time that the tool only runs against Looker sources implementing the required interface. Non-compatible sources cannot provide the Looker API client behavior the tool needs.
Source
Thrown at internal/tools/looker/lookerhealthpulse/lookerhealthpulse.go:113
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)
}
sdk, err := source.GetLookerSDK(ctx, string(accessToken))
if err != nil {
return nil, util.NewClientServerError("error getting sdk", http.StatusInternalServerError, err)
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Bind the tool to a Looker source in tools.yaml.
- Ensure the source implements every method required by compatibleSource.
- Reload the toolbox after correcting the configuration.
- Add a regression test invoking ValidateSource with the production source type.
Example fix
// before
tool.ValidateSource(otherSource{}) // error: not compatible
// after
var _ compatibleSource = looker.Source{}
tool.ValidateSource(lookerSource) Defensive patterns
Strategy: validation
Validate before calling
if err := tool.ValidateSource(src); err != nil {
return fmt.Errorf("looker-health-pulse requires looker source, got %T", src)
} Type guard
func okForPulse(s sources.Source) bool {
_, ok := s.(lookerhealthpulse.CompatibleSource)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
if strings.Contains(err.Error(), "not a compatible type") {
return fmt.Errorf("check tools.yaml source binding: %w", err)
}
return err
} Prevention
- Point looker-health-pulse tools at kind: looker sources only
- Run source validation as part of startup
- Test with the actual source type used in production
- Review YAML for typos in source names
When it happens
Trigger: Server-side validation passes a non-Looker source, or tools.yaml binds this tool to a source of the wrong kind, so the type assertion in ValidateSource fails.
Common situations: Wrong source reference in tools.yaml, renamed/changed source kinds, or unit tests supplying simplified stubs that don't implement compatibleSource.
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/c00797b290522741.
Report an issue: GitHub.