definePrompt
@tsed/platform-mcp
Usage
typescript
import { definePrompt } from "@tsed/platform-mcp";Overview
ts
function definePrompt<Args extends undefined = any>(options: PromptProps<Args>): import("@tsed/di").FactoryTokenProvider<{
argsSchema: import("zod").ZodObject<import("zod/v4/core").$ZodLooseShape, import("zod/v4/core").$strip> | undefined;
handler: PromptCallback<Args>;
description?: string | undefined;
title?: string | undefined;
name: string;
} | {
argsSchema: import("zod").ZodObject<import("zod/v4/core").$ZodLooseShape, import("zod/v4/core").$strip> | undefined;
handler: PromptCallback<Args>;
description?: string | undefined;
title?: string | undefined;
name: string;
token: Type | AbstractType<any>;
propertyKey: string | symbol;
}>;- options (
PromptProps<Args>): Functional or class-based prompt configuration.
Description
Registers an MCP prompt provider with the Ts.ED injector and returns the associated token.
Usage
ts
definePrompt({
name: "weather",
description: "Summaries today's forecast",
handler: async () => ({content: [{type: "text", text: "Sunny"}]})
});argsSchema: import
ts
argsSchema: import("zod").ZodObject<import("zod/v4/core").$ZodLooseShape, import("zod/v4/core").$strip> | undefined;handler
ts
handler: PromptCallback<Args>;description
ts
description?: string | undefined;title
ts
title?: string | undefined;name
ts
name: string;
ts
} | {argsSchema: import
ts
argsSchema: import("zod").ZodObject<import("zod/v4/core").$ZodLooseShape, import("zod/v4/core").$strip> | undefined;handler
ts
handler: PromptCallback<Args>;description
ts
description?: string | undefined;title
ts
title?: string | undefined;name
ts
name: string;token
ts
token: Type | AbstractType<any>;propertyKey
ts
propertyKey: string | symbol;