{"record":{"id":"aea1c7366215f1fc","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-aea1c7","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/postgres/postgresexecutesql/postgresexecutesql.go","lineNumber":122,"sourceCode":"\tresp, err := source.RunSQL(ctx, sql, nil)\n\tif err != nil {\n\t\treturn nil, util.ProcessGeneralError(err)\n\t}\n\treturn resp, nil\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\n// GetAnnotations dynamically returns readOnlyHint: true and destructiveHint: false\n// when the connected database source is in read-only mode.\nfunc (t Tool) GetAnnotations(src sources.Source) *tools.ToolAnnotations {\n\tbase := t.BaseTool.GetAnnotations(src)\n\tif src == nil || !src.IsReadOnly() {\n\t\treturn base\n\t}\n\n\tres := tools.NewReadOnlyAnnotations()\n\tif base != nil {\n\t\tcopied := *base\n\t\tcopied.ReadOnlyHint = res.ReadOnlyHint\n\t\tcopied.DestructiveHint = res.DestructiveHint\n\t\treturn &copied","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgresexecutesql/postgresexecutesql.go#L104-L140","documentation":"ValidateSource type-asserts the resolved source against the tool's compatibleSource interface (RunSQL over pgx). The error fires when the tool is bound to a source that is not a Postgres-compatible source, i.e. the tool kind and source kind in the YAML configuration are incompatible.","triggerScenarios":"Thrown at internal/tools/postgres/postgresexecutesql/postgresexecutesql.go:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point the tool's 'source' field at a Postgres-compatible source (e.g. postgres, cloudsql-postgres, alloydb-postgres) defined in tools.yaml","Ensure the source kind implements RunSQL over pgx/v5","Correct any typo in the source name that resolved to the wrong source"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}