{"record":{"id":"f913e5f00870a338","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-f913e5","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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql.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 get cast %s\", paramsMap[\"sql\"]), nil)\n\t}\n\n\tresp, err := source.RunSQL(ctx, sqlStr, nil)\n\tif err != nil {\n\t\treturn nil, util.ProcessGeneralError(err)","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql.go#L81-L117","documentation":"Tool.ValidateSource for mindsdb-execute-sql checks that the attached source implements compatibleSource (the MindsDB source interface). If the type assertion fails, the tool rejects the source because it cannot execute SQL against it. This is a startup/config-time compatibility check between tool and source kinds.","triggerScenarios":"Binding the mindsdb-execute-sql tool to a source of the wrong kind (e.g. a postgres or http source); the server calls ValidateSource when wiring tools to sources.","commonSituations":"Wrong source name in the tool's `source` field; source renamed or replaced with a different kind; copy-pasted tool definitions pointing at another database's source.","solutions":["Point the tool's `source` field at a MindsDB source (kind: mindsdb)","Confirm the source name matches the entry under `sources:` in tools.yaml","Restart/validate the toolbox config to confirm all bindings pass"],"exampleFix":"// before\ntools:\n  exec:\n    kind: mindsdb-execute-sql\n    source: my-alloydb\n// after\ntools:\n  exec:\n    kind: mindsdb-execute-sql\n    source: my-mindsdb","handlingStrategy":"validation","validationCode":"if err := tool.ValidateSource(sourcesMap[toolCfg.Source]); err != nil {\n    log.Fatalf(\"config invalid: %v\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bind mindsdb tools only to `kind: mindsdb` sources","Run config validation at startup before serving traffic","Keep source names descriptive (e.g. my-mindsdb) to reduce miswiring"],"tags":["go","mindsdb","source-binding","type-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"}