{"record":{"id":"79b0fddddfd77c6e","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-79b0fd","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/dataplex/dataplexgetdataqualityresults/dataplexgetdataqualityresults.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\tscanId, _ := paramsMap[\"scanId\"].(string)\n\tlocation, _ := paramsMap[\"location\"].(string)\n\n\tif scanId == \"\" {\n\t\treturn nil, util.NewAgentError(\"scanId parameter is required\", nil)\n\t}\n\tif location == \"\" {\n\t\treturn nil, util.NewAgentError(\"location parameter is required\", nil)","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/dataplex/dataplexgetdataqualityresults/dataplexgetdataqualityresults.go#L81-L117","documentation":"Raised by the dataplexgetdataqualityresults tool's ValidateSource when the given sources.Source does not implement the tool's `compatibleSource` interface (GetDataQualityResults). The tool requires a source capable of querying Dataplex data-quality scan results; any incompatible source fails the type assertion and produces this error before Invoke. This is a wiring/compatibility failure rather than a Dataplex API error.","triggerScenarios":"ValidateSource receives a source whose concrete type lacks GetDataQualityResults with the expected signature — e.g., tools.yaml binds this tool to a non-Dataplex source, or a test stub omits the method.","commonSituations":"Config mistakes where the `source` field references another engine's source; older source versions predating the data-quality-results method; refactors that renamed parameters and broke interface compliance; unit-test fakes implementing only sources.Source.","solutions":["Configure the tool with a Dataplex source that implements GetDataQualityResults.","Inspect the compatibleSource interface in internal/tools/dataplex/dataplexgetdataqualityresults/dataplexgetdataqualityresults.go and match it exactly.","Implement the missing method on any custom source with the exact signature.","Update stale source implementations/packages to the current interface."],"exampleFix":"// before\n// kind: dataplex-get-data-quality-results\n// source: alloydb-source   # lacks GetDataQualityResults\n//\n// after\n// kind: dataplex-get-data-quality-results\n// source: dataplex-source  # satisfies compatibleSource","handlingStrategy":"validation","validationCode":"func assertDataQualitySource(s sources.Source) error {\n\tif _, ok := s.(interface {\n\t\tGetDataQualityResults(ctx context.Context, /* params */) (*dataplex.DataQualityResult, error)\n\t}); !ok {\n\t\treturn errors.New(\"source must implement GetDataQualityResults for dataplex-get-data-quality-results\")\n\t}\n\treturn nil\n}","typeGuard":"func isDataQualitySource(s sources.Source) bool {\n\t_, ok := s.(dataplexgetdataqualityresults.CompatibleSource)\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\t// Non-retryable: correct the config/source, don't retry.\n\treturn nil, fmt.Errorf(\"non-retryable source compatibility failure: %w\", err)\n}","preventionTips":["Fail fast at startup by validating all tool/source bindings.","Keep custom source method signatures in sync with tool interfaces.","Add CI checks that compile-time assert interface satisfaction.","Use lint rules or code review checklists for tools.yaml changes."],"tags":["go","type-assertion","dataplex","source-compatibility","configuration"],"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"}