{"record":{"id":"27b4fd8d19cd0af7","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-27b4fd","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/firebird/firebirdexecutesql/firebirdexecutesql.go","lineNumber":99,"sourceCode":"\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\tparamsMap := params.AsMap()\n\tsqlStr, ok := paramsMap[\"sql\"].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"unable to cast parameter 'sql' to string: %v\", paramsMap[\"sql\"]), nil)\n\t}\n\n\t// Log the query executed for debugging.\n\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/firebird/firebirdexecutesql/firebirdexecutesql.go#L81-L117","documentation":"Tool.ValidateSource for the Firebird execute-sql tool fails when the injected source does not implement the tool's compatibleSource interface (i.e., it is not a Firebird source). The error reports the tool's configured type and source name so the developer can see the mismatch.","triggerScenarios":"A tools YAML config references a source name that maps to a non-Firebird source kind (e.g., a Postgres source) for a firebird-execute-sql tool; or the source failed to initialize and a different/uninitialized source is injected.","commonSituations":"Copy-pasting tool configs between source kinds without updating the 'source' field; source kind typos causing fallback type mismatch; wiring a shared tool to the wrong source kind.","solutions":["Set the tool's 'source' field to the name of a Firebird source (kind: firebird).","Verify the sources section declares the source with the correct kind.","Re-validate config with `toolbox --prebuilt` or run the server to confirm source-tool compatibility."],"exampleFix":"// before\ntools:\n  execute_sql:\n    kind: firebird-execute-sql\n    source: my-postgres\n// after\ntools:\n  execute_sql:\n    kind: firebird-execute-sql\n    source: my-firebird","handlingStrategy":"validation","validationCode":"# Verify tool's source kind matches before load\ncfg = yaml.safe_load(open('config.yaml'))\nsrc = cfg['sources'][tool['source']]\nassert src['kind'] == 'firebird', \"firebird-execute-sql requires a firebird source\"","typeGuard":null,"tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    log.Fatalf(\"source mismatch: %v (bind the tool to a 'kind: firebird' source)\", err)\n}","preventionTips":["Cross-check tool 'source' references against sources' kinds.","Name sources with their kind suffix (e.g., my-firebird) to avoid mismatches.","Run config validation in CI.","When copying tool blocks, update both kind and source."],"tags":["firebird","config","source-mismatch"],"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"}