{"record":{"id":"91b94b8be4a4ff5d","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-91b94b","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/trino/trinosql/trinosql.go","lineNumber":106,"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\n\tparamsMap := params.AsMap()\n\tnewStatement, err := parameters.ResolveTemplateParams(t.Cfg.TemplateParameters, t.Cfg.Statement, paramsMap)\n\tif err != nil {\n\t\treturn nil, util.NewAgentError(\"unable to extract template params\", err)\n\t}\n\tnewParams, err := parameters.GetParams(t.Cfg.Parameters, paramsMap)\n\tif err != nil {\n\t\treturn nil, util.NewAgentError(\"unable to extract standard params\", err)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/trino/trinosql/trinosql.go#L88-L124","documentation":"Trino SQL tools only work with sources that implement the compatibleSource interface (a Trino-compatible DB source). ValidateSource does a Go type assertion on the provided source and returns this error if it fails, preventing a tool from being paired with an incompatible source in the toolbox config.","triggerScenarios":"Configuring a tool of type trino-sql whose 'source' field points at a source of a different kind (e.g. postgres, alloydb, cloud-sql-postgres) instead of a Trino source; also when Invoke/ValidateSource receives a source that doesn't implement compatibleSource.","commonSituations":"Copy-pasting a prebuilt config and forgetting to change the source name; wiring tools to the wrong source kind in tools.yaml; renaming sources so the tool binds to a leftover incompatible source.","solutions":["Set the tool's 'source' field to a source defined with kind trino in the same tools.yaml","Check the source's kind under internal/sources to confirm it implements the Trino compatibleSource interface","Rebuild/restart toolbox and verify with the /mcp or tool list endpoint that the tool-source pairing loads"],"exampleFix":"# before\nsources:\n  my-pg:\n    kind: postgres\n    uri: postgres://...\ntools:\n  run-trino-sql:\n    kind: trino-execute-sql\n    source: my-pg\n# after\nsources:\n  my-trino:\n    kind: trino\n    host: trino.example.com\n    port: 8080\ntools:\n  run-trino-sql:\n    kind: trino-execute-sql\n    source: my-trino","handlingStrategy":"validation","validationCode":"// before starting toolbox, check pairing\nkind, _ := getSourceKind(toolsYAML, tool.Source)\nif kind != \"trino\" {\n    return fmt.Errorf(\"tool %s requires a trino source, got %s\", tool.Name, kind)\n}","typeGuard":"func asTrinoSource(s sources.Source) (compatibleSource, bool) {\n    cs, ok := s.(compatibleSource)\n    return cs, ok\n}","tryCatchPattern":null,"preventionTips":["Keep tool 'source' fields pointing at sources of the matching kind","Validate tools.yaml with a preflight load before deploying","Name sources to include their kind (e.g. trino-main) to avoid mixups"],"tags":["go","tool-configuration","trino","type-assertion"],"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"}