> ## 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.

# Register Prompts

> Register Redop prompts with arguments or argumentsSchema and understand how both fields behave together.

Register a prompt when you want clients to fetch reusable prompt material from your server.

## Choose your input model

Use `arguments` for named string inputs. Use `argumentsSchema` when the handler should receive parsed and validated values.

## Register a prompt with `arguments`

When you define prompt arguments inline, Redop infers their shape in the handler. In this example, `args.code` is required and `args.language` is optional.

```ts theme={null}
app.prompt("code_review", {
  description: "Review a code snippet",
  arguments: [
    { name: "code", required: true },
    { name: "language" },
  ],
  handler: ({ arguments: args }) => [
    {
      role: "user",
      content: {
        type: "text",
        text: `Review this ${args.language ?? "code"}:\n${args.code}`,
      },
    },
  ],
});
```

## Register a prompt with `argumentsSchema`

Use `argumentsSchema` when the prompt arguments need parsing or validation.

```ts theme={null}
import { z } from "zod";

app.prompt("summarise", {
  description: "Summarise a topic",
  argumentsSchema: z.object({
    limit: z.coerce.number().int().min(1),
    topic: z.string().min(1),
  }),
  handler: ({ arguments: args }) => [
    {
      role: "user",
      content: {
        type: "text",
        text: `Summarise ${args.topic} in ${args.limit} sentences.`,
      },
    },
  ],
});
```

## Use both fields carefully

You can define both `arguments` and `argumentsSchema` on the same prompt.

When you do:

* `arguments` controls MCP prompt metadata
* `arguments` controls the early missing-required-argument check
* `argumentsSchema` controls parsing and handler typing

Redop does not currently reject mismatches between them. Keep them aligned if you use both.

## When prompts fit best

* reusable prompt building blocks
* prompt material that should stay alongside your server logic
* flows where the client wants prompt metadata and arguments, not a tool call

## Related pages

* [Prompts](/docs/documentation/prompts)
* [Prompt definition](/docs/reference/prompt-definition)
* [Schema adapters](/docs/reference/schema-adapters)
