{"record":{"id":"9b58f3584213be4e","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-9b58f3","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/dataplexgetoperation/dataplexgetoperation.go","lineNumber":95,"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\toperationName, _ := paramsMap[\"operationName\"].(string)\n\n\tif operationName == \"\" {\n\t\treturn nil, util.NewAgentError(\"operationName parameter is required\", nil)\n\t}\n\n\tresp, err := source.GetOperation(ctx, operationName)\n\tif err != nil {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/dataplex/dataplexgetoperation/dataplexgetoperation.go#L77-L113","documentation":"Thrown by the dataplexgetoperation tool's ValidateSource when the passed sources.Source fails the assertion to `compatibleSource`, which requires a GetOperation(ctx, name) method. The tool uses this guard to guarantee the source can poll a Dataplex long-running operation before proceeding. The error means the tool was handed a source of an incompatible concrete type — a configuration or implementation issue, not an API failure.","triggerScenarios":"ValidateSource is called with any source that does not implement GetOperation(context.Context, string) — e.g., the tool is wired to a database source in tools.yaml, or a test passes a minimal stub of sources.Source.","commonSituations":"Tool YAML references the wrong source name; custom source lacks the GetOperation method; older source builds predate the method; interface compliance broken after a signature refactor.","solutions":["Point the tool's `source` config at a Dataplex source implementing GetOperation.","Verify the exact interface in internal/tools/dataplex/dataplexgetoperation/dataplexgetoperation.go and match it.","Implement GetOperation on custom sources with the exact signature.","Rebuild against the current source package if the implementation is stale."],"exampleFix":"// before\n// kind: dataplex-get-operation\n// source: postgres-source  # incompatible type\n//\n// after\n// kind: dataplex-get-operation\n// source: dataplex-source  # implements compatibleSource.GetOperation","handlingStrategy":"type-guard","validationCode":"type operationSource interface {\n\tGetOperation(ctx context.Context, name string) (*longrunningpb.Operation, error)\n}\nif _, ok := src.(operationSource); !ok {\n\treturn errors.New(\"source cannot poll Dataplex operations\")\n}","typeGuard":"func isGetOperationSource(s sources.Source) bool {\n\t_, ok := s.(dataplexgetoperation.CompatibleSource)\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\t// treat as configuration error; no retry\n\treturn nil, fmt.Errorf(\"fix source wiring for dataplex-get-operation: %w\", err)\n}","preventionTips":["Verify the source kind implements GetOperation before wiring long-running-operation tools.","Add startup validation of all configured tools.","Use `var _ compatibleSource = (*Source)(nil)` assertions in source code.","Keep test fakes aligned with production source method sets."],"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"}