Skip to content

MCP prompt arguments are listed optional but required at invocation #30

Description

@autocarl

Summary

A prompt route parameter is listed as optional in prompts/list, but prompts/get without the argument fails validation.

Reproduction

Minimal prerelease sample:

app.Map("ops troubleshoot {symptom}", static (string symptom) =>
        $"Investigate this symptom: '{symptom}'.")
    .WithDescription("Generate troubleshooting instructions for an agent.")
    .AsPrompt();

Using Repl.Mcp 0.11.0-dev.56 with MCP Inspector CLI:

npx --yes @modelcontextprotocol/inspector --cli ./run-mcp.sh --method prompts/list

Observed:

{
  "name": "ops_troubleshoot",
  "arguments": [
    {
      "name": "symptom",
      "description": "Observed symptom",
      "required": false
    }
  ]
}

Then:

npx --yes @modelcontextprotocol/inspector --cli ./run-mcp.sh \
  --method prompts/get \
  --prompt-name ops_troubleshoot

fails with:

Missing value for parameter 'symptom' (expected: string).

Providing the argument works:

npx --yes @modelcontextprotocol/inspector --cli ./run-mcp.sh \
  --method prompts/get \
  --prompt-name ops_troubleshoot \
  --prompt-args symptom="queue depth rising"

Expected behavior

prompts/list metadata and invocation validation should agree.

Possible directions:

  • mark route arguments as required if the MCP spec/client behavior allows it;
  • make prompt route parameters optional at execution time;
  • reject/diagnose .AsPrompt() routes that require positional route parameters unless defaults/optional segments are used.

Notes from source inspection

ReplMcpServerPrompt currently sets prompt argument metadata with:

Required = false // MCP spec: all prompt arguments must be optional.

but invocation still dispatches through the normal Repl route, where {symptom} is required.

Environment observed

  • Repl.Mcp: 0.11.0-dev.56
  • .NET SDK: 10.0.301
  • OS: Ubuntu 24.04 linux-x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions