Interface: PromptBuilder<TContext>
Defined in: packages/core/src/prompt/types.ts:377
Interface that all prompt builders must implement.
This is the abstraction that PromptRegistry depends on, following the Dependency Inversion Principle.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TContext | void | Application context passed to every handler |
Methods
buildPromptDefinition()
buildPromptDefinition(): {
arguments?: {
description?: string;
name: string;
required?: boolean;
}[];
description?: string;
name: string;
};Defined in: packages/core/src/prompt/types.ts:396
Build and return the MCP Prompt definition (for prompts/list).
Returns the prompt metadata including name, description, and argument definitions.
Returns
{
arguments?: {
description?: string;
name: string;
required?: boolean;
}[];
description?: string;
name: string;
}| Name | Type | Defined in |
|---|---|---|
arguments? | { description?: string; name: string; required?: boolean; }[] | packages/core/src/prompt/types.ts:399 |
description? | string | packages/core/src/prompt/types.ts:398 |
name | string | packages/core/src/prompt/types.ts:397 |
execute()
execute(ctx, args): Promise<PromptResult>;Defined in: packages/core/src/prompt/types.ts:415
Execute the prompt hydration with the given context and arguments.
Performs: coercion → validation → middleware → handler.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | TContext | Application context (from contextFactory) |
args | Record<string, string> | Raw string arguments from the MCP client |
Returns
Promise<PromptResult>
The hydrated prompt result with messages
getDescription()
getDescription(): string | undefined;Defined in: packages/core/src/prompt/types.ts:382
Get the prompt description
Returns
string | undefined
getHydrationTimeout()
getHydrationTimeout(): number | undefined;Defined in: packages/core/src/prompt/types.ts:426
Get the configured hydration timeout (in milliseconds).
When set, the handler is wrapped in a strict deadline. If the handler doesn't complete within this time, a SYSTEM ALERT is returned instead of freezing the UI.
Returns
number | undefined
Timeout in ms, or undefined if no deadline is configured
getName()
getName(): string;Defined in: packages/core/src/prompt/types.ts:379
Get the prompt name (used as the registration key)
Returns
string
getTags()
getTags(): string[];Defined in: packages/core/src/prompt/types.ts:385
Get the capability tags for selective exposure
Returns
string[]
hasMiddleware()
hasMiddleware(): boolean;Defined in: packages/core/src/prompt/types.ts:388
Whether this prompt has middleware
Returns
boolean