{"record":{"id":"a23efe8783666ce3","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-a23efe","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/trinoexecutesql/trinoexecutesql.go","lineNumber":101,"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\tsliceParams := params.AsSlice()\n\tsql, ok := sliceParams[0].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(\"unable to cast the `sql` input parameter into string\", nil)\n\t}\n\tres, err := source.RunSQL(ctx, sql, []any{})\n\tif err != nil {\n\t\treturn nil, util.ProcessGeneralError(err)","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/trino/trinoexecutesql/trinoexecutesql.go#L83-L119","documentation":"Tool.ValidateSource checks that the injected source implements the tool's compatibleSource interface (the Trino source). If the source is any other type, this error is returned with the tool's type and configured source name. Each tool only works with sources of its matching engine kind.","triggerScenarios":"Calling ValidateSource (or Invoke via the server after source resolution) on a trino-execute-sql Tool with a sources.Source that is not a Trino source — i.e. the tool's `source:` points at a non-Trino source.","commonSituations":"Pointing a trino-execute-sql tool at a Postgres/MySQL/other source by mistake; a custom source implementation that doesn't satisfy the Trino compatibleSource interface; copy-pasting a tool entry and forgetting to change the source.","solutions":["Change the tool's `source:` to reference a source of kind trino","Verify the referenced source's kind in the sources section matches the tool's engine","If using a custom source, ensure it implements the Trino source's compatibleSource interface"],"exampleFix":"// before (tools.yaml)\nrun_query:\n  kind: trino-execute-sql\n  source: my-postgres\n// after\nrun_query:\n  kind: trino-execute-sql\n  source: my-trino","handlingStrategy":"type-guard","validationCode":"if sourceKindOf[tool.Source] != \"trino\" {\n    return fmt.Errorf(\"trino-execute-sql requires a trino source, got %q\", sourceKindOf[tool.Source])\n}","typeGuard":"func isTrinoSource(s sources.Source) bool {\n    _, ok := s.(trinosource.Source) // satisfies trinoexecutesql's compatibleSource\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"repoint the tool's source to a trino source: %w\", err)\n}","preventionTips":["Name sources after their engine (e.g. trino_prod) to prevent mismatches","Never share one source key across different engine kinds","Validate tool/source pairing at config load time"],"tags":["go","trino","type-mismatch","source-compatibility"],"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"}