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 dataplexgetdataprofile tool's ValidateSource emits this error when `source.(compatibleSource)` fails — the supplied source does not implement the GetDataProfile method the tool needs. This guard ensures the tool never invokes a method that doesn't exist on the wired source. The error reflects a tool/source type mismatch in configuration or code, not a runtime API failure.
Source
Thrown at internal/tools/dataplex/dataplexgetdataprofile/dataplexgetdataprofile.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
- Point the tool's `source` config at a Dataplex source implementing GetDataProfile.
- Verify interface satisfaction against compatibleSource in internal/tools/dataplex/dataplexgetdataprofile/dataplexgetdataprofile.go.
- Add/repair the GetDataProfile method on custom sources to match the interface.
- Add a compile-time assertion `var _ compatibleSource = (*mySource)(nil)` to catch drift early.
Example fix
// before // func (s *MySource) GetDataProfile(ctx context.Context, id string) (*dataplex.DataProfileResult, error) // wrong signature // // after: match interface exactly // func (s *MySource) GetDataProfile(ctx context.Context, locationId, dataAssetId string) (*dataplex.DataProfileResult, error)
Defensive patterns
Strategy: type-guard
Validate before calling
var _ interface {
GetDataProfile(ctx context.Context, locationId, dataAssetId string) (*dataplex.DataProfileResult, error)
} = (*myDataplexSource)(nil) Type guard
func isGetDataProfileSource(s sources.Source) bool {
_, ok := s.(dataplexgetdataprofile.CompatibleSource)
return ok
} Try / catch
err := tool.ValidateSource(src)
if err != nil {
var ve *util.ToolboxError
if errors.As(err, &ve) {
return nil, fmt.Errorf("reconfigure tool %q with a dataplex source", toolName)
}
return nil, err
} Prevention
- Embed interface assertions in source implementations.
- Review tools.yaml tool->source mappings during code review.
- Run `go vet`/unit tests that exercise ValidateSource.
- Pin tool and source implementations to the same version.
When it happens
Trigger: Calling ValidateSource with a non-Dataplex source, a Dataplex source lacking GetDataProfile(ctx, locationId, dataAssetId), or a test double that only implements sources.Source.
Common situations: Wrong source referenced in the tool's YAML block; custom or legacy source implementations missing the profile-lookup method; method signature changes during refactors breaking interface satisfaction; mixing tool definitions from different releases.
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/143681fe24457bb7.
Report an issue: GitHub.