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
RequiresClientAuthorization for cloudloggingadmin-querylogs asserts the source implements compatibleSource to read UseClientAuthorization(). A source of any other Go type fails the assertion and produces this error, meaning the tool was bound to a non-Cloud Logging Admin source.
Source
Thrown at internal/tools/cloudloggingadmin/cloudloggingadminquerylogs/cloudloggingadminquerylogs.go:182
Filter: filter,
NewestFirst: newestFirst,
StartTime: startTime,
EndTime: endTime,
Verbose: verbose,
Limit: limit,
}
resp, err := source.QueryLogs(ctx, queryParams, tokenString)
if err != nil {
return nil, util.ProcessGcpError(err)
}
return resp, nil
}
func (t Tool) RequiresClientAuthorization(source sources.Source) (bool, error) {
s, ok := source.(compatibleSource)
if !ok {
return false, fmt.Errorf("invalid source for %q tool: source %q is not a compatible type", t.Cfg.Type, t.Cfg.Source)
}
return s.UseClientAuthorization(), nil
}
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 nilView on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool at a cloud-logging-admin-compatible source.
- Add UseClientAuthorization() bool to custom source wrappers.
- Validate config at startup to surface the mismatch early.
Example fix
// before
query-logs:
kind: cloud-logging-admin-query-logs
source: my-postgres
// after
query-logs:
kind: cloud-logging-admin-query-logs
source: my-logging-admin Defensive patterns
Strategy: type-guard
Validate before calling
// Go: verify the source satisfies the tool's interface before use
if _, ok := src.(compatibleSource); !ok {
return fmt.Errorf("query-logs tool requires a cloud-logging-admin source, got %T", src)
} Type guard
func asCompatibleSource(s sources.Source) (compatibleSource, bool) {
cs, ok := s.(compatibleSource)
return cs, ok
} Try / catch
ok, err := tool.RequiresClientAuthorization(src)
if err != nil {
return fmt.Errorf("cannot resolve auth mode: %w", err)
} Prevention
- Compile-time assert custom sources: var _ compatibleSource = (*mySource)(nil).
- Validate tool/source kind pairing during config load.
- Keep tool bindings and sources sections edited together in the same PR.
When it happens
Trigger: Auth resolution during tool invocation or registration when tools.yaml binds querylogs to a database source or a custom source missing UseClientAuthorization().
Common situations: Wrong source name in tools.yaml; version upgrades that changed the source interface; custom source wrappers lacking the required method.
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/e53f7bc6aa885654.
Report an issue: GitHub.