{"record":{"id":"387fc4ffc3077090","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-387fc4","errorCode":null,"errorMessage":"invalid source for %q tool: source %q is not a compatible type","messagePattern":"invalid source for %q tool: source %q is not a compatible type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/firestoremongodb/firestoremongodbgetschema/firestoremongodbgetschema.go","lineNumber":103,"sourceCode":"// validate interface\nvar _ tools.Tool = Tool{}\n\ntype Tool struct {\n\ttools.BaseTool[Config]\n}\n\nfunc (t Tool) GetSourceName() string {\n\treturn t.Cfg.Source\n}\n\nfunc (t Tool) ToConfig() tools.ToolConfig {\n\treturn t.Cfg\n}\n\nfunc (t Tool) ValidateSource(source sources.Source) error {\n\t_, ok := source.(compatibleSource)\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid source for %q tool: source %q is not a compatible type\", t.Cfg.Type, t.Cfg.Source)\n\t}\n\treturn nil\n}\n\nfunc (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {\n\tsource, ok := s.(compatibleSource)\n\tif !ok {\n\t\treturn nil, util.NewClientServerError(\"source used is not compatible with the tool\", http.StatusInternalServerError, nil)\n\t}\n\tmapParams := params.AsMap()\n\n\tcollection, _ := mapParams[collectionKey].(string)\n\n\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, util.NewClientServerError(\"error getting logger\", http.StatusInternalServerError, err)\n\t}\n\tlogger.DebugContext(ctx, fmt.Sprintf(\"executing `%s` tool for collection: %q\", resourceType, collection))","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/firestoremongodb/firestoremongodbgetschema/firestoremongodbgetschema.go#L85-L121","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nschema-tool:\n  type: firestore-mongodb-get-schema\n  source: alloydb-src\n# after\nschema-tool:\n  type: firestore-mongodb-get-schema\n  source: firestore-mongodb-src","handlingStrategy":"validation","validationCode":"// Check tool/source kind pairing before startup\nif tool.Type == \"firestore-mongodb-get-schema\" && cfg.Sources[tool.Source].Kind != \"firestore-mongodb\" {\n    return fmt.Errorf(\"tool %q needs a firestore-mongodb source\", tool.Name)\n}","typeGuard":"func isFirestoreMongoDBSource(s sources.Source) bool {\n    _, ok := s.(interface {\n        FirestoreClient() *firestore.Client\n        ExecuteMQL(context.Context, string) (any, error)\n    })\n    return ok\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["go","config","source-compatibility"],"backgroundTag":"incompatible-source-type","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}