googleapis/mcp-toolbox · error
unknown prompt type: %q
Error message
unknown prompt type: %q
What it means
DecodeConfig resolves a prompt's `kind` (resourceType) against the promptRegistry of registered prompt factories, defaulting to "custom" when kind is empty. It throws this error when the kind is set to a value that has no registered factory, so the prompt config cannot be decoded.
Source
Thrown at internal/prompts/prompts.go:55
if _, exists := promptRegistry[resourceType]; exists {
// Prompt with this type already exists, do not overwrite.
return false
}
promptRegistry[resourceType] = factory
return true
}
// DecodeConfig looks up the registered factory for the given type and uses it
// to decode the prompt configuration.
func DecodeConfig(ctx context.Context, resourceType, name string, decoder *yaml.Decoder) (PromptConfig, error) {
factory, found := promptRegistry[resourceType]
if !found && resourceType == "" {
resourceType = "custom"
factory, found = promptRegistry[resourceType]
}
if !found {
return nil, fmt.Errorf("unknown prompt type: %q", resourceType)
}
promptConfig, err := factory(ctx, name, decoder)
if err != nil {
return nil, fmt.Errorf("unable to parse prompt %q as resourceType %q: %w", name, resourceType, err)
}
return promptConfig, nil
}
type PromptConfig interface {
PromptConfigType() string
Initialize() (Prompt, error)
}
type Prompt interface {
GetDesc() string
GetArguments() Arguments
SubstituteParams(parameters.ParamValues) (any, error)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Remove the `kind:` field or set it to `custom` to use the default prompt factory.
- Check spelling/casing of kind against the registered prompt types (e.g. the keys in promptRegistry).
- Ensure the package providing the custom prompt factory is imported so its init() registers it.
- Upgrade the toolbox binary if the kind is only supported in newer versions.
Example fix
// before
prompts:
my-prompt:
kind: gcp_prompt
description: ...
// after
prompts:
my-prompt:
kind: custom
description: ... Defensive patterns
Strategy: validation
Validate before calling
knownKinds := map[string]bool{"": true, "custom": true /* + registered kinds */}
if !knownKinds[promptCfg.Kind] {
return fmt.Errorf("prompt kind %q unknown; use 'custom' or omit kind", promptCfg.Kind)
} Try / catch
pc, err := prompts.DecodeConfig(ctx, name, decoder)
if err != nil {
if strings.Contains(err.Error(), "unknown prompt type") {
return fmt.Errorf("set prompts kind to 'custom' (or omit it); %w", err)
}
return err
} Prevention
- Omit `kind:` in prompt definitions unless using a registered custom prompt type.
- Check kind spelling/casing against registered prompt factories.
- Import the package registering any custom prompt kind so its init() runs.
- Keep toolbox binary version aligned with the config schema version you author against.
When it happens
Trigger: A prompt in tools.yaml declares `kind: mydb_prompt` (or any non-empty kind other than registered types like "custom"), and no factory for that kind was registered via the registry's Register call at init time.
Common situations: Typo in kind (e.g. "Custom" with capital C); copying a kind from a tools/config section into a prompts section where it isn't valid; using a kind from an extension not imported into the binary so its init never ran; version mismatch where the kind was added in a newer release.
Related errors
- error parsing argument: %w
- invalid role %q: must be 'user' or 'assistant'
- unable to parse prebuilt tool configuration for '%s': %w
- prebuilt source tool for '%s' not found. %s
- error substituting params for message: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/3251844678d94a76.
Report an issue: GitHub.