googleapis/mcp-toolbox · error

invalid 'type' field for prompt %q (must be a string)

Error message

invalid 'type' field for prompt %q (must be a string)

What it means

Error "invalid 'type' field for prompt %q (must be a string)" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/server/config.go:588

		return group.GroupConfig{}, fmt.Errorf("unable to unmarshal group: %s", err)
	}
	// The default (nameless) group always contains all configured tools and
	// prompts, so it may only set a description.
	if name == "" && (len(gc.ToolNames) > 0 || len(gc.PromptNames) > 0) {
		return group.GroupConfig{}, fmt.Errorf("the default (nameless) group cannot declare 'tools' or 'prompts'; it always contains all configured tools and prompts")
	}
	return gc, nil
}

func UnmarshalYAMLPromptConfig(ctx context.Context, name string, r map[string]any) (prompts.PromptConfig, error) {
	// Look for the 'type' field. If it's not present, typeStr will be an
	// empty string, which prompts.DecodeConfig will correctly default to "custom".
	var resourceType string
	if typeVal, ok := r["type"]; ok {
		var isString bool
		resourceType, isString = typeVal.(string)
		if !isString {
			return nil, fmt.Errorf("invalid 'type' field for prompt %q (must be a string)", name)
		}
	}
	dec, err := util.NewStrictDecoder(r)
	if err != nil {
		return nil, fmt.Errorf("error creating decoder: %s", err)
	}

	// Use the central registry to decode the prompt based on its type.
	promptCfg, err := prompts.DecodeConfig(ctx, resourceType, name, dec)
	if err != nil {
		return nil, err
	}
	return promptCfg, nil
}

// Tools naming validation is added in the MCP v2025-11-25, but we'll be
// implementing it across Toolbox
// Tool names SHOULD be between 1 and 128 characters in length (inclusive).

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/server/config.go:588 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/feee0ae3897124ad. Report an issue: GitHub.