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
firestore-list-collections' ValidateSource asserts the provided sources.Source implements compatibleSource. A source of any other type (non-Firestore) fails the check and returns this error instead of proceeding to Invoke.
Source
Thrown at internal/tools/firestore/firestorelistcollections/firestorelistcollections.go:104
// validate interface
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)
}
mapParams := params.AsMap()
// Check if parentPath is provided
parentPath, _ := mapParams[parentPathKey].(string)
if parentPath != "" {
// Validate parent document path
if err := fsUtil.ValidateDocumentPath(parentPath); err != nil {
return nil, util.NewAgentError(fmt.Sprintf("invalid parent document path: %v", err), err)
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Wire the tool to a firestore-kind source via the `source:` field.
- Verify the source's `kind: firestore` in the config and that it initialized without error.
Example fix
// before
list_collections:
kind: firestore-list-collections
source: my-mysql
// after
list_collections:
kind: firestore-list-collections
source: my-firestore Defensive patterns
Strategy: type-guard
Validate before calling
if err := listCollTool.ValidateSource(src); err != nil {
return fmt.Errorf("firestore-list-collections requires a firestore source: %w", err)
} Type guard
func isFirestore(s sources.Source) bool {
_, ok := s.(firestore.CompatibleSource)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
log.Printf("incompatible source: %v", err)
return err
} Prevention
- Keep firestore tools under a source whose kind is firestore.
- Add a startup assertion per tool that ValidateSource passes.
- Re-run config validation after any source kind change.
When it happens
Trigger: Calling ValidateSource or Invoke with a sources.Source whose concrete Go type is not the Firestore source.
Common situations: Config pointing the tool at a SQL/other source; programmatic misuse passing the wrong source object.
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/9096d5ee3a9caea0.
Report an issue: GitHub.