{"record":{"id":"066fc58497dcb562","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-066fc5","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/dataplexsearchdqscans/dataplexsearchdqscans.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\tparamsMap := params.AsMap()\n\tfilter, _ := paramsMap[\"filter\"].(string)\n\tdataScanID, _ := paramsMap[\"dataScanId\"].(string)\n\tresourcePath, _ := paramsMap[\"resourcePath\"].(string)\n\tpageSize, _ := paramsMap[\"pageSize\"].(int)\n\torderBy, _ := paramsMap[\"orderBy\"].(string)\n\n\tvar filters []string\n\tif filter != \"\" {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/dataplex/dataplexsearchdqscans/dataplexsearchdqscans.go#L83-L119","documentation":"dataplex-search-dq-scans requires a source implementing its compatibleSource interface (SearchDqScans method). ValidateSource returns this error when the injected source is of an incompatible type, guarding against misconfigured tool/source bindings.","triggerScenarios":"ValidateSource is invoked with a sources.Source lacking the SearchDqScans method required for dataplex-search-dq-scans.","commonSituations":"YAML wiring the tool to a database source; a source block deleted/renamed so the tool binds to the wrong entry.","solutions":["Point the tool's source at a dataplex source in the config","Verify the source kind is dataplex and it initializes","Restart the server and confirm no validation errors at startup"],"exampleFix":"// before\nsource: mysql\n// after\nsource: dataplex","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(interface {\n\tSearchDqScans(ctx context.Context, query string, pageSize int32) (*dataplex.GoogleCloudDataplexV1SearchScansResponse, error)\n}); !ok {\n\treturn fmt.Errorf(\"source %T does not support SearchDqScans\", src)\n}","typeGuard":"func isDataplexSearchDqScansSource(s sources.Source) bool {\n\t_, ok := s.(interface {\n\t\tSearchDqScans(ctx context.Context, query string, pageSize int32) (*dataplex.GoogleCloudDataplexV1SearchScansResponse, error)\n\t})\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\t// incompatible source: rebind the tool to a dataplex source\n\treturn fmt.Errorf(\"invalid tool source: %w\", err)\n}","preventionTips":["Verify the source referenced by the tool is kind dataplex","Run toolbox startup validation and address errors before serving","Avoid hand-editing source names without re-validating config"],"tags":["go","dataplex","type-mismatch","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"}