{"record":{"id":"1534b867489d0c65","repo":"googleapis/mcp-toolbox","slug":"source-is-not-compatible-with-the-tool-1534b8","errorCode":null,"errorMessage":"source is not compatible with the tool","messagePattern":"source is not compatible with the tool","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/bigtable/bigtablegetcluster/bigtablegetcluster.go","lineNumber":95,"sourceCode":"\t\t\tallParameters,\n\t\t),\n\t}, nil\n}\n\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) ValidateSource(src sources.Source) error {\n\t_, ok := src.(compatibleSource)\n\tif !ok {\n\t\treturn fmt.Errorf(\"source is not compatible with the tool\")\n\t}\n\treturn nil\n}\n\nfunc (t Tool) ToConfig() tools.ToolConfig {\n\treturn t.Cfg\n}\n\nfunc (t Tool) Invoke(ctx context.Context, src sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {\n\tsource, ok := src.(compatibleSource)\n\tif !ok {\n\t\treturn nil, util.NewClientServerError(\"source used is not compatible with the tool\", http.StatusInternalServerError, nil)\n\t}\n\n\tparamsMap := params.AsMap()\n\n\tres, err := source.GetCluster(ctx, paramsMap[\"instance_id\"].(string), paramsMap[\"cluster_id\"].(string))\n\tif err != nil {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/bigtable/bigtablegetcluster/bigtablegetcluster.go#L77-L113","documentation":"ValidateSource for the bigtable-get-cluster tool performs a compatibleSource type assertion on the given source and returns 'source is not compatible with the tool' when it fails. This ensures the tool only runs against Bigtable sources that expose the cluster APIs it needs.","triggerScenarios":"ValidateSource called with any sources.Source that is not the Bigtable compatibleSource — wrong source kind bound to the tool, or a stub in tests.","commonSituations":"Misconfigured tools.yaml pointing get-cluster at a non-Bigtable source; custom source implementations missing required methods; copy-pasted tool blocks referencing the previous tool's source.","solutions":["Point the tool at a bigtable source.","Implement compatibleSource on custom Bigtable source wrappers.","Fix the source reference in the tool config and restart.","Check for copy-paste mistakes where a sibling tool's source was reused."],"exampleFix":"// before\ntools:\n  get-cluster:\n    kind: bigtable-get-cluster\n    source: my-spanner-source\n// after\ntools:\n  get-cluster:\n    kind: bigtable-get-cluster\n    source: my-bigtable-source","handlingStrategy":"type-guard","validationCode":"func isBigtableSource(s sources.Source) bool {\n    _, ok := s.(interface{ BigtableInstanceAdminClient() *bigtable.InstanceAdminClient }); return ok\n}\n// then tool.ValidateSource(src)","typeGuard":"func asBigtable(s sources.Source) (compatibleSource, bool) { c, ok := s.(compatibleSource); return c, ok }","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"bigtable-get-cluster needs a bigtable source: %w\", err)\n}","preventionTips":["Bind bigtable-get-cluster only to bigtable sources.","Validate all tool/source pairs at startup.","Avoid reusing a sibling tool's source name blindly in configs.","Include binding assertions in unit tests for each bigtable tool."],"tags":["go","bigtable","type-assertion","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"}