Skip to content

prompts/get returns argument and handler errors as successful messages #210

Description

@mcollina

prompts.md (Error Handling) says servers SHOULD return -32602 for missing required arguments and -32603 for internal errors, and SHOULD validate prompt arguments.

handlePromptsGet in src/handlers.ts instead returns a successful GetPromptResult:

  • A TypeBox argumentSchema failure returns a messages result containing "Invalid prompt arguments: …".
  • A prompt declared with arguments: [{ name, required: true }] but no argumentSchema is not validated at all, so the handler runs with the argument undefined.
  • An error thrown by the prompt handler is also returned as a success message.

Also, prompts/list exposes the internal argumentSchema field, which is not part of the Prompt schema.

resources/read has the same pattern ("Resource read failed: …" returned as content). PR #170 fixes that on the 2026-07-28 path because it now attaches caching hints, which could make shared caches store the error.

Found while reviewing #170. Already present on main.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions