{"record":{"id":"311e40e1f5f46f90","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-311e40","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/dataplexsearchentries/dataplexsearchentries.go","lineNumber":104,"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\tquery, ok := paramsMap[\"query\"].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"error casting 'query' parameter: %v\", paramsMap[\"query\"]), nil)\n\t}\n\tpageSize, ok := paramsMap[\"pageSize\"].(int)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"error casting 'pageSize' parameter: %v\", paramsMap[\"pageSize\"]), nil)\n\t}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries.go#L86-L122","documentation":"dataplex-search-entries validates its attached source implements its compatibleSource interface (SearchEntries method). ValidateSource returns this error when any other source type is supplied. It ensures the tool only runs against a Dataplex source that can perform entry searches.","triggerScenarios":"ValidateSource (or Invoke) receives a sources.Source that does not implement compatibleSource (SearchEntries) for dataplex-search-entries.","commonSituations":"Tool bound to the wrong source in YAML; copy-pasted config from another integration; source renamed without updating tool bindings.","solutions":["Bind the tool to a dataplex source in the config","Check the referenced source name/kind in the sources section","Run startup validation and fix any reported source mismatches"],"exampleFix":"// before\nsource: spanner\n// after\nsource: dataplex","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(interface {\n\tSearchEntries(ctx context.Context, query string, pageSize int32, orderBy string) (*dataplex.GoogleCloudDataplexV1SearchEntriesResponse, error)\n}); !ok {\n\treturn fmt.Errorf(\"source %T does not support SearchEntries\", src)\n}","typeGuard":"func isDataplexSearchEntriesSource(s sources.Source) bool {\n\t_, ok := s.(interface {\n\t\tSearchEntries(ctx context.Context, query string, pageSize int32, orderBy string) (*dataplex.GoogleCloudDataplexV1SearchEntriesResponse, error)\n\t})\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\t// incompatible source: point the tool at the dataplex source\n\treturn fmt.Errorf(\"invalid tool source: %w\", err)\n}","preventionTips":["Always wire dataplex tools to a dataplex source","Include source-interface assertions in unit tests","Restart and check logs for ValidateSource errors after config edits"],"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"}