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
firestore-mongodb-get-schema tools require a source implementing compatibleSource (FirestoreClient() and ExecuteMQL). ValidateSource is called at startup with the configured source; if the type assertion fails because the source is a different kind, this error is returned.
Source
Thrown at internal/tools/firestoremongodb/firestoremongodbgetschema/firestoremongodbgetschema.go:103
// 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)
}
mapParams := params.AsMap()
collection, _ := mapParams[collectionKey].(string)
logger, err := util.LoggerFromContext(ctx)
if err != nil {
return nil, util.NewClientServerError("error getting logger", http.StatusInternalServerError, err)
}
logger.DebugContext(ctx, fmt.Sprintf("executing `%s` tool for collection: %q", resourceType, collection))View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's "source" field at a source of kind "firestore-mongodb" in tools.yaml.
- Cross-check the source's "kind" in the sources: section against the tool type.
- Rename the tool's source or create a new firestore-mongodb source if none exists.
Example fix
# before schema-tool: type: firestore-mongodb-get-schema source: alloydb-src # after schema-tool: type: firestore-mongodb-get-schema source: firestore-mongodb-src
Defensive patterns
Strategy: validation
Validate before calling
// Check tool/source kind pairing before startup
if tool.Type == "firestore-mongodb-get-schema" && cfg.Sources[tool.Source].Kind != "firestore-mongodb" {
return fmt.Errorf("tool %q needs a firestore-mongodb source", tool.Name)
} Type guard
func isFirestoreMongoDBSource(s sources.Source) bool {
_, ok := s.(interface {
FirestoreClient() *firestore.Client
ExecuteMQL(context.Context, string) (any, error)
})
return ok
} Prevention
- Verify the source kind listed under sources: matches the tool's documented requirement
- Avoid sharing one source name across tools of different types
- Add a config smoke test that instantiates all tools in CI
When it happens
Trigger: A "firestore-mongodb-get-schema" tool's "source" field names a source whose Go type does not implement compatibleSource, e.g. a postgres or http source, causing source.(compatibleSource) to fail.
Common situations: Wrong source name in tools.yaml after renaming sources; reusing a tool template across configs without updating the source; sharing one source name between tools of different types.
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/387fc4ffc3077090.
Report an issue: GitHub.