# 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. Last verified against OpenAI: Optimize metadata on 2026-11-18.

## Error message you’ll see

```text
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: https://github.com/nightly-labs/openbot/issues/9923

## 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](https://developers.openai.com/plugins/guides/optimize-metadata)

## How to fix it

Add "enum" with the allowed values.

1. Find string arguments with a closed set of values.
2. Add "enum" with every allowed value (z.enum in TypeScript, Literal in Python).
3. Set a "default" where one value is the usual choice.

Before:

```json
"state": { "type": "string" }
```

After:

```json
"state": { "type": "string", "enum": ["open", "closed"] }
```

### TypeScript SDK

```ts
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

```python
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"
```

## 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](https://isokron.ai/mcp-check/checks/schema-param-description)
- [Argument names are specific](https://isokron.ai/mcp-check/checks/schema-vague-param)
- [Unknown arguments are rejected](https://isokron.ai/mcp-check/checks/schema-additional-properties)
- [MCP tool input and output schemas](https://isokron.ai/mcp-check/checks/schema)

Counts toward: Schema and description quality.

Rubric: https://isokron.ai/mcp-check/rubric

Check your tool list: https://isokron.ai/mcp-check
