OpenParable
Skip to content
← Back to skills

MCP Schema Enum Regression

Agent Building
mcp-schema-enum-regression

MCP Schema Enum Regression is an Agent Skill for agent building published in the sbroenne/mcp-server-excel repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Keep generated MCP schemas strict-client compatible by avoiding nullable enum signatures.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/sbroenne/mcp-server-excel/blob/HEAD/.squad/skills/mcp-schema-enum-regression/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/mcp-schema-enum-regression, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Context

Use this when an MCP client rejects tool schemas because enum arrays include invalid sentinel members (often surfaced as null or empty strings).

Patterns

  • Test the published contract with ListToolsAsync() and recurse every schema node that contains an enum array.
  • Treat nullable enum parameters in MCP tool signatures as the hazard point; strict clients do not tolerate the SDK's sentinel output for them.
  • Keep the primary action parameter as a required enum when you want discoverable action lists.
  • Emit other action-specific enum inputs as optional strings, then parse them in generated MCP code before routing.
  • For [FromString] enum paths, keep the string transport shape and let the existing service-side parser do the enum conversion.

Examples

  • src/ExcelMcp.Generators.Mcp/McpToolGenerator.cs: required action enum, optional enum-like inputs as strings, local parse for direct enum parameters.
  • tests/ExcelMcp.McpServer.Tests/Integration/Tools/GeneratedToolSchemaEnumRegressionTests.cs: recursive schema regression plus focused optional-parameter check.

Anti-Patterns

  • Do not patch one generated .g.cs output by hand.
  • Do not leave nullable enums in published MCP signatures and hope clients normalize them.
  • Do not fix only action; scan every enum-bearing property across the tool catalog.