//#region src/lib/decorator.d.ts /** * Metadata stored by @MCPRoute on a class */ type MCPOAuthMode = 'required' | 'optional' | false; interface MCPRouteMetadata { name: string; description?: string; tag?: string; oauth: MCPOAuthMode; } /** * Base class for MCP route handlers. * Subclass this and decorate with @MCPRoute to create a tool resolver. * * @typeParam T - The response type returned by the TSOA controller method. */ declare abstract class BaseMCPRoute { /** * Transform the raw controller response into MCP-friendly output. * Override this to filter/reshape large JSON payloads. * Default: pass through as-is. */ resolve(response: T): unknown; } /** Constructor type for MCPRoute classes */ type MCPRouteClass = new () => BaseMCPRoute; /** * Class decorator that marks a class as an MCP route handler. * * @example * ```typescript * @MCPRoute("get_room_id") * @MCPDescription("Fetch the Room ID for a TikTok user") * class RoomIdMCPRoute extends BaseMCPRoute { * resolve(response: WebcastRoomIdRouteResponse) { * return { room_id: response.room_id, is_live: response.is_live }; * } * } * ``` */ declare function MCPRoute(name: string): (target: MCPRouteClass) => void; /** * Class decorator that prefixes the tool name with a tag. * Apply below @MCPRoute (decorators execute bottom-up). * * @example * ```typescript * @MCPRoute("mute_room_user") * @MCPTag("mutes") * @MCPDescription("Mute a user in a TikTok LIVE room") * class MuteRoomUserMCPRoute extends BaseMCPRoute { ... } * // Registered as "mutes-mute_room_user" * ``` */ declare function MCPTag(tag: string): (target: MCPRouteClass) => void; /** * Class decorator that marks an MCP tool as requiring OAuth authentication. * Apply below @MCPRoute (decorators execute bottom-up). * * @param required If true, tool is hidden when OAuth is not active. If false, tool is shown but header params become tool params. * * @example * ```typescript * @MCPRoute("get_user_info") * @MCPOAuth(true) // hidden without OAuth * class GetUserInfoMCPRoute extends BaseMCPRoute { ... } * * @MCPRoute("ban_room_user") * @MCPOAuth(false) // shown without OAuth, cookie param exposed * class BanRoomUserMCPRoute extends BaseMCPRoute { ... } * ``` */ declare function MCPOAuth(required: boolean): (target: MCPRouteClass) => void; /** * Class decorator that sets a description on an @MCPRoute class. * Apply below @MCPRoute (decorators execute bottom-up). * * @example * ```typescript * @MCPRoute("get_room_id") * @MCPDescription("Fetch the Room ID for a TikTok user") * class RoomIdMCPRoute extends BaseMCPRoute { ... } * ``` */ declare function MCPDescription(description: string): (target: MCPRouteClass) => void; /** * Method decorator that links a TSOA controller method to an @MCPRoute class. * * @example * ```typescript * @Get() * @Tool(RoomIdMCPRoute) * @Security(Features.RoomId) * public async retrieveRoomId(...) { ... } * ``` */ declare function Tool(routeClass: MCPRouteClass): (_target: object, _propertyKey: string, descriptor: PropertyDescriptor) => void; //#endregion export { BaseMCPRoute, MCPDescription, MCPOAuth, MCPOAuthMode, MCPRoute, MCPRouteClass, MCPRouteMetadata, MCPTag, Tool }; //# sourceMappingURL=decorator.d.ts.map