{"record":{"id":"d2a59b78e902c818","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-d2a59b","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/cloudsqlpg/vectorassistapplyspec/vectorassistapplyspec.go","lineNumber":131,"sourceCode":"\tresp, err := source.RunSQL(ctx, applySpecQuery, []any{namedArgs})\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","sourceCodeStart":113,"sourceCodeEnd":135,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudsqlpg/vectorassistapplyspec/vectorassistapplyspec.go#L113-L135","documentation":"vector-assist-apply-spec only works with sources exposing a pgx pool and RunSQL helper (its compatibleSource interface). ValidateSource returns this error when the bound sources.Source does not satisfy that interface, i.e. it is not a Postgres-based source the Vector Assist tooling can drive.","triggerScenarios":"Tool initialization/validate step where `source.(compatibleSource)` fails — binding vector-assist-apply-spec to a non-postgres source (mysql, cloud-sql-mysql, spanner, etc.) or a source missing RunSQL/PostgresPool support.","commonSituations":"Attaching Vector Assist tools to the wrong engine's source; using an older custom source that predates the RunSQL-bearing interface; copy-pasted configs across toolsets.","solutions":["Bind the tool to a postgres or cloud-sql-postgres source that implements PostgresPool() and RunSQL()","Check that your custom source (if any) satisfies the full compatibleSource interface","Verify the config with the tool manifest before deployment"],"exampleFix":"// before\nsource: my-mysql\n// after\nsource: my-postgres  # kind: postgres or cloud-sql-postgres","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(interface{ RunSQL(context.Context, string, []any) (any, error) }); !ok { return errors.New(\"vector-assist tools need a postgres-based source\") }","typeGuard":"func isVectorAssistSource(s sources.Source) bool {\n    _, ok := s.(interface {\n        PostgresPool() *pgxpool.Pool\n        RunSQL(context.Context, string, []any) (any, error)\n    })\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"vector-assist-apply-spec cannot bind to this source: %w\", err)\n}","preventionTips":["Bind all vector-assist tools to postgres-family sources only","Update custom sources to implement RunSQL/PostgresPool when adopting vector-assist tools","Validate the toolset at startup so binding mistakes surface before requests"],"tags":["go","type-assertion","configuration","vector-assist"],"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"}