import type { FromSchema, Schema } from '@sozai/schema' import { contentBlock, role } from './content.js' import { cacheableResult, icon, notification, paginatedRequest, paginatedResult, request, result, } from './rpc.js' // https://github.com/modelcontextprotocol/specification/blob/bb5fdd282a4d0793822a569f573ebc36804d38f8/schema/schema.json#L1296 export const promptArgument = { description: 'Describes an argument that a prompt can accept.', properties: { description: { description: 'A human-readable description of the argument.', type: 'string', }, name: { description: "Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).", type: 'string', }, required: { description: 'Whether this argument must be provided.', type: 'boolean', }, title: { description: 'Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display (except for Tool,\nwhere `annotations.title` should be given precedence over using `name`,\nif present).', type: 'string', }, }, required: ['name'], type: 'object', } as const satisfies Schema export type PromptArgument = FromSchema export const prompt = { description: 'A prompt or prompt template that the server offers.', properties: { arguments: { description: 'A list of arguments to use for templating the prompt.', items: promptArgument, type: 'array', }, description: { description: 'An optional description of what this prompt provides', type: 'string', }, icons: { description: 'Optional icons representing the prompt.', items: icon, type: 'array', }, name: { description: 'The name of the prompt or prompt template.', type: 'string', }, title: { description: 'Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\neven by those unfamiliar with domain-specific terminology.\n\nIf not provided, the name should be used for display.', type: 'string', }, }, required: ['name'], type: 'object', } as const satisfies Schema export type Prompt = FromSchema // https://github.com/modelcontextprotocol/specification/blob/bb5fdd282a4d0793822a569f573ebc36804d38f8/schema/schema.json#L1341 export const promptMessage = { description: 'Describes a message returned as part of a prompt.\n\nThis is similar to `SamplingMessage`, but also supports the embedding of\nresources from the MCP server.', properties: { content: contentBlock, role, }, required: ['content', 'role'], type: 'object', } as const satisfies Schema // https://github.com/modelcontextprotocol/specification/blob/bb5fdd282a4d0793822a569f573ebc36804d38f8/schema/schema.json#L483 export const getPromptRequest = { description: 'Used by the client to get a prompt provided by the server.', allOf: [ request, { properties: { method: { const: 'prompts/get', type: 'string', }, params: { properties: { arguments: { additionalProperties: { type: 'string', }, description: 'Arguments to use for templating the prompt.', type: 'object', }, name: { description: 'The name of the prompt or prompt template.', type: 'string', }, }, required: ['name'], type: 'object', }, }, required: ['method', 'params'], type: 'object', }, ], } as const satisfies Schema export type GetPromptRequest = FromSchema // https://github.com/modelcontextprotocol/specification/blob/bb5fdd282a4d0793822a569f573ebc36804d38f8/schema/schema.json#L516 export const getPromptResult = { description: "The server's response to a prompts/get request from the client.", allOf: [ result, { properties: { description: { description: 'An optional description for the prompt.', type: 'string', }, messages: { items: promptMessage, type: 'array', }, }, required: ['messages'], type: 'object', }, ], } as const satisfies Schema export type GetPromptResult = FromSchema // https://github.com/modelcontextprotocol/specification/blob/bb5fdd282a4d0793822a569f573ebc36804d38f8/schema/schema.json#L825 export const listPromptsRequest = { description: 'Sent from the client to request a list of prompts and prompt templates the server has.', allOf: [ paginatedRequest, { properties: { method: { const: 'prompts/list', type: 'string', }, }, required: ['method'], type: 'object', }, ], } as const satisfies Schema export type ListPromptsRequest = FromSchema // https://github.com/modelcontextprotocol/specification/blob/bb5fdd282a4d0793822a569f573ebc36804d38f8/schema/schema.json#L847 export const listPromptsResult = { description: "The server's response to a prompts/list request from the client.", allOf: [ paginatedResult, cacheableResult, { properties: { prompts: { items: prompt, type: 'array', }, }, required: ['prompts'], type: 'object', }, ], } as const satisfies Schema export type ListPromptsResult = FromSchema // https://github.com/modelcontextprotocol/specification/blob/bb5fdd282a4d0793822a569f573ebc36804d38f8/schema/schema.json#L1317 export const promptListChangedNotification = { description: 'An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.', allOf: [ notification, { properties: { method: { const: 'notifications/prompts/list_changed', type: 'string', }, }, required: ['method'], type: 'object', }, ], } as const satisfies Schema export type PromptListChangedNotification = FromSchema