googleapis/mcp-toolbox · error
invalid source for %q tool: source %q is not a compatible ty
Error message
invalid source for %q tool: source %q is not a compatible type
What it means
The dataplexgetdatainsights tool's ValidateSource returns this error when the injected sources.Source does not satisfy the tool's private `compatibleSource` interface (a GetDataInsights method). This is a fail-fast guard: the type assertion `source.(compatibleSource)` fails, so the tool reports that the source is not a compatible type rather than attempting an API call. It indicates a tool-to-source wiring mismatch, not a Dataplex API problem.
Source
Thrown at internal/tools/dataplex/dataplexgetdatainsights/dataplexgetdatainsights.go:99
var _ tools.Tool = Tool{}
type Tool struct {
tools.BaseTool[Config]
}
func (t Tool) GetSourceName() string {
return t.Cfg.Source
}
func (t Tool) ToConfig() tools.ToolConfig {
return t.Cfg
}
func (t Tool) ValidateSource(source sources.Source) error {
_, ok := source.(compatibleSource)
if !ok {
return fmt.Errorf("invalid source for %q tool: source %q is not a compatible type", t.Cfg.Type, t.Cfg.Source)
}
return nil
}
func (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {
source, ok := s.(compatibleSource)
if !ok {
return nil, util.NewClientServerError("source used is not compatible with the tool", http.StatusInternalServerError, nil)
}
paramsMap := params.AsMap()
scanId, _ := paramsMap["scanId"].(string)
location, _ := paramsMap["location"].(string)
if scanId == "" {
return nil, util.NewAgentError("scanId parameter is required", nil)
}
if location == "" {
return nil, util.NewAgentError("location parameter is required", nil)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Configure the tool with a `source` that is a Dataplex source implementing GetDataInsights.
- Compare your source's method set against the compatibleSource interface in internal/tools/dataplex/dataplexgetdatainsights/dataplexgetdatainsights.go.
- Add or fix the GetDataInsights method on your custom source to match the interface exactly.
- Rebuild/redeploy with a current source implementation if the interface drifted.
Example fix
// before: test stub missing method
// type fakeSource struct{}
// func (f fakeSource) SourceType() string { return "dataplex" }
//
// after
// type fakeSource struct{}
// func (f fakeSource) SourceType() string { return "dataplex" }
// func (f fakeSource) GetDataInsights(ctx context.Context, /* params */) (*dataplex.Facet, error) { ... } Defensive patterns
Strategy: type-guard
Validate before calling
if _, ok := src.(interface {
GetDataInsights(ctx context.Context, /* params */) (*dataplex.Facet, error)
}); !ok {
return errors.New("source does not support dataplex-get-data-insights")
} Type guard
func isGetDataInsightsSource(s sources.Source) bool {
_, ok := s.(dataplexgetdatainsights.CompatibleSource)
return ok
} Try / catch
defer func() {
if r := recover(); r != nil { /* not needed: ValidateSource returns error */ }
}()
if err := tool.ValidateSource(src); err != nil {
return nil, fmt.Errorf("swap to a dataplex source: %w", err)
} Prevention
- Wire each dataplex tool to a dataplex source in tools.yaml.
- Assert interface satisfaction at compile time in custom sources.
- Add ValidateSource checks to config-load tests.
- Keep tool and source packages on the same release version.
When it happens
Trigger: Passing any sources.Source to ValidateSource that lacks the GetDataInsights method signature required by this tool's compatibleSource interface — e.g., wiring the tool to a non-Dataplex source in the YAML config, or supplying a mock in tests.
Common situations: Copy-pasted tool configs referencing the wrong source name; a custom source implementation missing the GetDataInsights method; interface drift after refactoring the source's method signature; running an old binary where the source kind was registered differently.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/91f5bc9a1c53879e.
Report an issue: GitHub.