Interface: PromptConfig<TContext, TArgs>
Defined in: packages/core/src/prompt/types.ts:437
Configuration for definePrompt().
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TContext | - | Application context type |
TArgs extends Record<string, unknown> | Record<string, unknown> | Validated args type (inferred from args) |
Properties
args?
optional args:
| ZodObject<ZodRawShape, UnknownKeysParam, ZodTypeAny, {
[key: string]: any;
}, {
[key: string]: any;
}>
| PromptParamsMap;Defined in: packages/core/src/prompt/types.ts:457
Argument definitions.
Accepts either:
PromptParamsMap(JSON descriptors) — zero Zod imports neededZodObject— for power users who need full Zod control
Constraint: Only flat primitives allowed. Arrays and nested objects will fail with a runtime error at definition time.
description?
optional description: string;Defined in: packages/core/src/prompt/types.ts:442
Human-readable description shown in the slash command palette
handler()
handler: (ctx, args) => Promise<PromptResult>;Defined in: packages/core/src/prompt/types.ts:496
The hydration handler.
Receives validated, typed, coerced args and returns a PromptResult. This is where server-side data fetching and Presenter calls happen.
DX: ctx is typed as TContext & LoopbackContext — invokeTool() appears in autocomplete without any manual cast.
Parameters
| Parameter | Type |
|---|---|
ctx | TContext & LoopbackContext |
args | TArgs |
Returns
Promise<PromptResult>
hydrationTimeout?
optional hydrationTimeout: number;Defined in: packages/core/src/prompt/types.ts:485
Maximum hydration time in milliseconds.
When set, the handler is wrapped in a strict deadline. If external data sources (APIs, databases) don't respond within this time, the framework cuts the Promise and returns a graceful SYSTEM ALERT. The UI unblocks immediately — the user never sees a frozen screen.
Example
definePrompt('morning_briefing', {
hydrationTimeout: 3000, // 3 seconds strict
handler: async (ctx, args) => {
// If Jira takes 15s, the framework cuts at 3s
const tickets = await ctx.invokeTool('jira.get_assigned');
return { messages: [...] };
},
});icons?
optional icons: {
dark?: string;
light?: string;
};Defined in: packages/core/src/prompt/types.ts:445
Icons for light/dark themes (MCP spec Icons)
dark?
optional dark: string;light?
optional light: string;middleware?
optional middleware: MiddlewareFn<TContext>[];Defined in: packages/core/src/prompt/types.ts:463
Middleware chain (same signature as tool middleware)
tags?
optional tags: string[];Defined in: packages/core/src/prompt/types.ts:460
Capability tags for selective exposure
title?
optional title: string;Defined in: packages/core/src/prompt/types.ts:439
Human-readable title for display in UI (MCP spec BaseMetadata.title)