Constrained arguments list their allowed values
Arguments such as state, status, type, sort or order take a fixed set of values, so list them with "enum"; without it the model invents values and the server rejects the call.
Check schema-enum-missing · Schema and description quality · default severity: advice · rubric 2.1.0
Error message you’ll see
MCP error -32602: Input validation error: Invalid arguments for tool create_post: Invalid option: expected one of […]TypeScript SDK server, when the model sends a value outside the enum (the allowed values follow). Where this was reported
What fails
Arguments such as state, status, type, sort or order almost always take a fixed set of values. Without an enum the model invents values the server then rejects.
The rule
Parameter docs: describe each argument, include examples, and use allowed values for constrained inputs.
Source: OpenAI: Optimize metadata
How to fix it
Add "enum" with the allowed values.
- Find string arguments with a closed set of values.
- Add "enum" with every allowed value (z.enum in TypeScript, Literal in Python).
- Set a "default" where one value is the usual choice.
"state": { "type": "string" }"state": { "type": "string", "enum": ["open", "closed"] }TypeScript SDK
import { McpServer } from '@modelcontextprotocol/server';
import * as z from 'zod';
const server = new McpServer({ name: 'issues', version: '1.0.0' });
server.registerTool(
'list_issues',
{
title: 'List issues',
description: 'List issues in a project. Use when the user asks for issues by state.',
inputSchema: z.strictObject({
project_id: z.string().describe('Project ID, for example PRJ-7'),
state: z.enum(['open', 'closed', 'all']).default('open').describe('Which issues to include'),
sort: z.enum(['created', 'updated']).default('updated').describe('Sort field'),
}),
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
},
async ({ project_id, state, sort }) => ({ content: [{ type: 'text', text: 'Done' }] }),
);Python SDK
from typing import Annotated, Literal
from pydantic import Field
from mcp.server.mcpserver import MCPServer
from mcp.types import ToolAnnotations
server = MCPServer("issues")
@server.tool(
title="List issues",
annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False, openWorldHint=False),
)
def list_issues(
project_id: Annotated[str, Field(description="Project ID, for example PRJ-7")],
state: Annotated[Literal["open", "closed", "all"], Field(description="Which issues to include")] = "open",
sort: Annotated[Literal["created", "updated"], Field(description="Sort field")] = "updated",
) -> str:
"""List issues in a project. Use when the user asks for issues by state."""
return "Done"Run against @modelcontextprotocol/server 2.4.0, mcp 2.3.0 and fastmcp 4.2.2 on 2026-11-18; the checker confirms this check passes on the tool list each snippet produces.
Questions
What does the model do without an enum?
It guesses plausible values: "Open", "active", "resolved". The server rejects them, and the model retries or gives up.
Should I use enum or const?
enum for a set of values, const for exactly one. Many model APIs reject const or enum at the root of a schema, but inside a property both are fine.
Related checks
- Every argument has a description
- Argument names are specific
- Unknown arguments are rejected
- All checks in MCP tool input and output schemas
How this check is graded
It counts toward: Schema and description quality. See the rubric.
Last verified against OpenAI: Optimize metadata on 2026-11-18. The rule above is quoted in the source’s own words. This page as Markdown.
Check your tool list: paste your tools/list, nothing is sent anywhere