{"record":{"id":"aa268a9e73c16105","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-aa268a","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/dataplexlistdataassets/dataplexlistdataassets.go","lineNumber":117,"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\tlocationId, ok := paramsMap[\"locationId\"].(string)\n\tif !ok || locationId == \"\" {\n\t\treturn nil, util.NewAgentError(\"locationId is required and must be a non-empty string\", nil)\n\t}\n\tdataProductId, ok := paramsMap[\"dataProductId\"].(string)\n\tif !ok || dataProductId == \"\" {\n\t\treturn nil, util.NewAgentError(\"dataProductId is required and must be a non-empty string\", nil)\n\t}","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/dataplex/dataplexlistdataassets/dataplexlistdataassets.go#L99-L135","documentation":"Raised by the dataplexlistdataassets tool's ValidateSource when the supplied sources.Source cannot be asserted to the tool's `compatibleSource` interface, i.e., it does not implement ListDataAssets. The tool requires a source able to list Dataplex assets within a data product; any other source kind fails validation with this message. It's a fail-fast compatibility check, not a Dataplex API error.","triggerScenarios":"ValidateSource (or server startup) receives a source whose concrete type is missing ListDataAssets(ctx, projectId, locationId, dataProductId) — e.g., the tool block in tools.yaml points at a different engine's source, or a test supplies a stub implementing only sources.Source.","commonSituations":"Copy-pasted tool configs retaining the wrong `source:` value; custom source integrations missing the listing method; interface drift after a signature change; running an outdated binary where the source kind's method set differs.","solutions":["Set the tool's `source` to a Dataplex source implementing ListDataAssets.","Verify compliance with the compatibleSource interface in internal/tools/dataplex/dataplexlistdataassets/dataplexlistdataassets.go.","Implement the missing ListDataAssets method on custom sources with the exact signature.","Add a compile-time assertion `var _ compatibleSource = (*MySource)(nil)` to prevent future drift."],"exampleFix":"// before\n// kind: dataplex-list-data-assets\n// source: mssql-source   # does not implement ListDataAssets\n//\n// after\n// kind: dataplex-list-data-assets\n// source: dataplex-source # implements compatibleSource","handlingStrategy":"type-guard","validationCode":"var _ interface {\n\tListDataAssets(ctx context.Context, projectId, locationId, dataProductId string) ([]*dataplex.DataAsset, error)\n} = (*myDataplexSource)(nil)","typeGuard":"func isListDataAssetsSource(s sources.Source) bool {\n\t_, ok := s.(dataplexlistdataassets.CompatibleSource)\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\tif strings.Contains(err.Error(), \"not a compatible type\") {\n\t\t// Swap in the correct dataplex source; do not retry.\n\t\treturn nil, fmt.Errorf(\"tool %q misconfigured: %w\", toolName, err)\n\t}\n\treturn nil, err\n}","preventionTips":["Check `source:` values in tools.yaml point at dataplex sources for dataplex tools.","Add compile-time assertions to all custom source implementations.","Include ValidateSource assertions in config-loading unit tests.","Review tools.yaml diffs carefully when copying existing tool blocks."],"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-08T15:18:49.778Z"}