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
This error is returned by the looker-get-connection-table-columns tool's ValidateSource when the sources.Source instance passed to the tool does not implement the tool's compatibleSource interface (UseClientAuthorization() bool, GetAuthTokenHeaderName() string, LookerApiSettings() *rtl.ApiSettings). The toolbox only wires Looker tools to a Looker source, so this means the tool was bound to a source of the wrong kind (e.g. a Postgres or other database source instead of a Looker source). It is a configuration/wiring error, not a runtime data error.
Source
Thrown at internal/tools/looker/lookergetconnectiontablecolumns/lookergetconnectiontablecolumns.go:109
// 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)
}
logger, err := util.LoggerFromContext(ctx)
if err != nil {
return nil, util.NewClientServerError("unable to get logger from ctx", http.StatusInternalServerError, err)
}
mapParams := params.AsMap()
conn, ok := mapParams["conn"].(string)
if !ok {
return nil, util.NewAgentError(fmt.Sprintf("'conn' must be a string, got %T", mapParams["conn"]), nil)
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's `source` field in your config at a Looker source definition (kind: looker), not a database source.
- If using a custom/stub source, implement the full compatibleSource interface: UseClientAuthorization() bool, GetAuthTokenHeaderName() string, LookerApiSettings() *rtl.ApiSettings.
- Use prebuilt Looker configs or copy the source block from the Looker docs so source kind and tool match.
- If the interface changed after an upgrade, update your source implementation to satisfy the new methods (compiler will list them).
Example fix
# before (tools.yaml)
tools:
get-columns:
kind: looker-get-connection-table-columns
source: my-postgres-source
# after
sources:
my-looker:
kind: looker
...
tools:
get-columns:
kind: looker-get-connection-table-columns
source: my-looker Defensive patterns
Strategy: type-guard
Validate before calling
if _, ok := source.(lookergetconnectiontablecolumns.CompatibleSource); !ok {
return fmt.Errorf("tool %q requires a Looker source; got %T", toolName, source)
} Type guard
func isCompatibleLookerSource(s sources.Source) bool {
_, ok := s.(interface {
UseClientAuthorization() bool
GetAuthTokenHeaderName() string
LookerApiSettings() *rtl.ApiSettings
})
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
log.Fatalf("tool/source mismatch: %v", err) // fail fast at startup
} Prevention
- Bind Looker tools only to sources with kind: looker in tools.yaml.
- Run server startup validation (ValidateSource) before accepting traffic.
- Keep a compile-time assertion in Go: var _ compatibleSource = looker.Source{}.
- When copying tool configs, always copy the source block from the same doc page.
When it happens
Trigger: Calling ValidateSource (directly or via server/tool startup validation) with a source whose concrete type does not satisfy compatibleSource — for example binding looker-get-connection-table-columns to a non-Looker source, or using a source that implements sources.Source but not the Looker-specific interface methods.
Common situations: Hand-writing a tools.yaml where the tool's source field points at the wrong source definition; refactoring/renaming sources and mis-wiring; programmatically constructing a tool + source pair in tests with a stub source that lacks LookerApiSettings/UseClientAuthorization/GetAuthTokenHeaderName; upgrading after the compatibleSource interface gained new methods so an older custom source no longer satisfies it.
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/5156a5259693018c.
Report an issue: GitHub.