{"record":{"id":"7dd2de2d351e7300","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-7dd2de","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/dataplexsearchaspecttypes/dataplexsearchaspecttypes.go","lineNumber":98,"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":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes.go#L80-L116","documentation":"dataplex-search-aspect-types validates that its attached source implements its compatibleSource interface (SearchAspectTypes method). ValidateSource returns this error for any other source type. This is a tool-to-source wiring check at configuration/startup time.","triggerScenarios":"Calling ValidateSource with a sources.Source that does not implement compatibleSource (SearchAspectTypes(ctx, query, pageSize)).","commonSituations":"Tool config bound to a wrong source kind; source renamed or replaced with a non-Dataplex source during refactoring.","solutions":["Attach a dataplex source to the tool in the YAML config","Check tool startup validation logs for the failing binding","Recreate the tool block pointing at the Dataplex source"],"exampleFix":"// before\nsource: postgres\n// after\nsource: dataplex","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(interface {\n\tSearchAspectTypes(ctx context.Context, query string, pageSize int32) (*dataplex.GoogleCloudDataplexV1SearchAspectTypesResponse, error)\n}); !ok {\n\treturn fmt.Errorf(\"source %T does not support SearchAspectTypes\", src)\n}","typeGuard":"func isDataplexSearchAspectTypesSource(s sources.Source) bool {\n\t_, ok := s.(interface {\n\t\tSearchAspectTypes(ctx context.Context, query string, pageSize int32) (*dataplex.GoogleCloudDataplexV1SearchAspectTypesResponse, error)\n\t})\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\t// incompatible source: fix the tool->source binding in config\n\treturn fmt.Errorf(\"invalid tool source: %w\", err)\n}","preventionTips":["Bind dataplex tools only to dataplex sources","Let startup ValidateSource catch bad bindings early","Review source kind when reusing tool config templates"],"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"}