Skip to content

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 ParameterDefault typeDescription
TContextvoidApplication context passed to every handler

Methods

buildPromptDefinition()

ts
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

ts
{
  arguments?: {
     description?: string;
     name: string;
     required?: boolean;
  }[];
  description?: string;
  name: string;
}
NameTypeDefined in
arguments?{ description?: string; name: string; required?: boolean; }[]packages/core/src/prompt/types.ts:399
description?stringpackages/core/src/prompt/types.ts:398
namestringpackages/core/src/prompt/types.ts:397

execute()

ts
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

ParameterTypeDescription
ctxTContextApplication context (from contextFactory)
argsRecord<string, string>Raw string arguments from the MCP client

Returns

Promise<PromptResult>

The hydrated prompt result with messages


getDescription()

ts
getDescription(): string | undefined;

Defined in: packages/core/src/prompt/types.ts:382

Get the prompt description

Returns

string | undefined


getHydrationTimeout()

ts
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()

ts
getName(): string;

Defined in: packages/core/src/prompt/types.ts:379

Get the prompt name (used as the registration key)

Returns

string


getTags()

ts
getTags(): string[];

Defined in: packages/core/src/prompt/types.ts:385

Get the capability tags for selective exposure

Returns

string[]


hasMiddleware()

ts
hasMiddleware(): boolean;

Defined in: packages/core/src/prompt/types.ts:388

Whether this prompt has middleware

Returns

boolean