Prompt definitions register MCP prompts and control prompt metadata, handler input, prompt-local hooks, and middleware.Documentation Index
Fetch the complete documentation index at: https://redop.useagents.site/docs/llms.txt
Use this file to discover all available pages before exploring further.
Example with arguments
Example with argumentsSchema
Fields
| Field | Required | Purpose |
|---|---|---|
description | No | Short prompt description. |
arguments | No | Named prompt arguments exposed to clients and used for required-argument checks. |
argumentsSchema | No | Schema used to parse and validate prompt arguments before the handler runs. |
before | No | Prompt-local hook that runs before middleware and the handler. |
after | No | Prompt-local hook that runs after a successful result and may replace it. |
afterResponse | No | Prompt-local hook that runs after the response is written. Receives either result or error and cannot replace the response. |
middleware | No | Middleware scoped to this prompt only. |
handler | Yes | Returns prompt messages or { description?, messages }. |
arguments
When you register a prompt with a literal arguments array, Redop infers the handler arguments shape from that definition.
{ name: "text", required: true }becomesarguments.text: string{ name: "length" }becomesarguments.length?: string- prompts without an
argumentsdefinition receiveargumentsasundefined
argumentsSchema
argumentsSchema accepts the same schema styles Redop supports for tool inputSchema.
- Standard Schema V1 libraries such as Zod, Valibot, and ArkType
- TypeBox
- plain JSON Schema
argumentsSchema is present, the prompt handler receives the parsed schema output instead of a raw Record<string, string>.
If you omit arguments, Redop derives prompt argument metadata from an object-shaped argumentsSchema when possible.
When both are defined
Defining botharguments and argumentsSchema does not throw by itself.
Redop resolves them like this:
argumentscontrols prompt metadata returned to clientsargumentsdrives the early missing-required-argument checkargumentsSchemaparses and validates the incoming argumentsargumentsSchemadetermines the handlerargumentstype
arguments, when both are present.
If the two definitions disagree, metadata and runtime validation can drift. Redop does not currently reject that mismatch automatically.
Use both fields only when you need custom metadata and schema-based parsing at the same time, and keep them aligned.
Prompt naming
Prompt names are validated when you call.prompt(name, def).
- use a stable identifier such as
code_revieworsummarise - keep names within 64 characters
- use letters, numbers,
_,-,., and/ - avoid spaces and trailing whitespace
Prompt message content
Prompt messages can contain:- text
- image data
- embedded resource payloads
Notes
- Use
afterResponsefor analytics or logging that should happen after the prompt response is already sent. - Use
afterinstead when the logic must still be able to replace the successful prompt result.