#
tokens: 20412/50000 10/11 files (page 1/2)
lines: on (toggle) GitHub
raw markdown copy reset
This is page 1 of 2. Use http://codebase.md/evalstate/mcp-miro?lines=true&page={x} to view the full context.

# Directory Structure

```
├── .gitignore
├── 2024-12-02-screenshot_1.png
├── LICENSE
├── package-lock.json
├── package.json
├── prompts
│   ├── 01-oauthtoken.md
│   ├── 02-boards-as-resources.md
│   └── ref
│       ├── mcp-llms.txt.md
│       └── mcp-types.ts
├── README.md
├── resources
│   └── boards-key-facts.md
├── src
│   ├── index.ts
│   └── MiroClient.ts
└── tsconfig.json
```

# Files

--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------

```
1 | node_modules/
2 | build/
3 | *.log
4 | .env*
5 | prompts/ref/miro-spec.json
6 | 
```

--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------

```markdown
 1 | # mcp-miro MCP Server
 2 | [![smithery badge](https://smithery.ai/badge/@llmindset/mcp-miro)](https://smithery.ai/server/@llmindset/mcp-miro)
 3 | 
 4 | A Model Context Protocol server to connect to the MIRO Whiteboard Application.
 5 | 
 6 | - Allows Board manipulation, sticky creation, bulk operations and more.
 7 | - Pass your OAuth key as an Environment Variable, or using the "--token" argument.
 8 | - Taking a photo of stickies and asking Claude to create MIRO equivalent works _really_ well.
 9 | 
10 | <a href="https://glama.ai/mcp/servers/gr5t7vthv3"><img width="380" height="200" src="https://glama.ai/mcp/servers/gr5t7vthv3/badge" alt="mcp-miro MCP server" /></a>
11 | 
12 | ## Installation
13 | 
14 | ### Installing via Smithery
15 | 
16 | To install MIRO Whiteboard Connector for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@llmindset/mcp-miro):
17 | 
18 | ```bash
19 | npx -y @smithery/cli install @llmindset/mcp-miro --client claude
20 | ```
21 | 
22 | ### Using mcp-get
23 | 
24 | You can install this package using mcp-get:
25 | 
26 | ```bash
27 | npx @michaellatman/mcp-get@latest install @llmindset/mcp-miro
28 | ```
29 | 
30 | _Note - if you are using an old version of Windows PowerShell, you may need to run_ `Set-ExecutionPolicy Bypass -Scope Process` _before this command._
31 | 
32 | ## Features
33 | 
34 | ![MIRO/Claude Desktop Screenshot](./2024-12-02-screenshot_1.png)
35 | 
36 | ### Resources
37 | - Get Board Contents 
38 | 
39 | ### Tools
40 | - Create Sticky, Shape
41 | - Read Board, Frame, Contents
42 | - Bulk Create
43 | 
44 | ### Prompts
45 | - Instruct on Board Coordinates etc.
46 | 
47 | ## Development
48 | 
49 | Install dependencies:
50 | ```bash
51 | npm install
52 | ```
53 | 
54 | Build the server:
55 | ```bash
56 | npm run build
57 | ```
58 | 
59 | For development with auto-rebuild:
60 | ```bash
61 | npm run watch
62 | ```
63 | 
64 | ## Installation
65 | 
66 | To use with Claude Desktop, add the server config:
67 | 
68 | On MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
69 | On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
70 | 
71 | ```json
72 | {
73 |   "mcpServers": {
74 |     "mcp-miro": {
75 |       "command": "/path/to/node-or-npx",
76 |       "arguments": [
77 |         "/path/to/mcp-miro/build/index.js",
78 |         "--token","MIRO-OAUTH-KEY"
79 |       ]
80 |     }
81 |   }
82 | }
83 | ```
84 | 
85 | ### Debugging
86 | 
87 | Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector), which is available as a package script:
88 | 
89 | ```bash
90 | npm run inspector
91 | ```
92 | 
93 | The Inspector will provide a URL to access debugging tools in your browser.
94 | 
95 | In Dev environment recommend adding https://github.com/miroapp/api-clients/blob/041de24ebf7955432b447d887ede066ad4c7e2c7/packages/generator/spec.json for reference.
96 | 
```

--------------------------------------------------------------------------------
/prompts/01-oauthtoken.md:
--------------------------------------------------------------------------------

```markdown
1 | we need to have access to an OAUTH token to access an API. it should be possible to be passed in either as an environment variable "MIRO_OAUTH_TOKEN", or as a command line argument. if both are present, the command line takes precedence. use standard typescript and node technique/libraries to achieve this.
2 | 
```

--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "compilerOptions": {
 3 |     "target": "ES2022",
 4 |     "module": "Node16",
 5 |     "moduleResolution": "Node16",
 6 |     "outDir": "./build",
 7 |     "rootDir": "./src",
 8 |     "strict": true,
 9 |     "esModuleInterop": true,
10 |     "skipLibCheck": true,
11 |     "forceConsistentCasingInFileNames": true
12 |   },
13 |   "include": ["src/**/*"],
14 |   "exclude": ["node_modules"]
15 | }
16 | 
```

--------------------------------------------------------------------------------
/resources/boards-key-facts.md:
--------------------------------------------------------------------------------

```markdown
 1 | # Key facts about Miro boards and coordinates
 2 | 
 3 | ## Board Coordinates
 4 | 
 5 | - Boards are infinite and zoomable in all directions
 6 | - The board center is at coordinates (0,0)
 7 | - All board-level coordinates are relative to this center point
 8 | - Board items use x,y coordinates to specify their position
 9 | - Item coordinates mark the CENTER point of the item
10 | 
11 | ## Coordinate Types
12 | 
13 | - Board-level: Items directly on board use coordinates relative to board center (0,0)
14 | - Parent-child: Child items inside parent containers (like frames) use coordinates relative to parent's top-left corner
15 | 
16 | ## Units
17 | 
18 | - Measurements use board units
19 | - 100 board units = 100 device-independent pixels at 100% zoom
20 | 
21 | ## Default Behavior
22 | 
23 |  -Items created without specified coordinates default to board center (0,0)
24 |  -Frames always appear behind other board items in the z-order
25 |  -The initial viewport center when creating a new board becomes the board's (0,0) reference point
26 | 
```

--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "name": "@llmindset/mcp-miro",
 3 |   "version": "0.1.1",
 4 |   "description": "A Model Context Protocol server to connect to the MIRO Whiteboard Application",
 5 |   "type": "module",
 6 |   "publishConfig": {
 7 |     "access": "public"
 8 |   },  
 9 |   "bin": {
10 |     "mcp-miro": "./build/index.js"
11 |   },
12 |   "files": [
13 |     "build"
14 |   ],
15 |   "repository": {
16 |     "type": "git",
17 |     "url": "git+https://github.com/evalstate/mcp-miro"
18 |   },
19 |   "bugs":{
20 |     "url": "https://github.com/evalstate/mcp-miro/issues"
21 |   },  
22 |   "scripts": {
23 |     "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
24 |     "prepare": "npm run build",
25 |     "watch": "tsc --watch",
26 |     "inspector": "npx @modelcontextprotocol/inspector build/index.js"
27 |   },
28 |   "dependencies": {
29 |     "@modelcontextprotocol/sdk": "0.6.0",
30 |     "node-fetch": "^3.3.2",
31 |     "yargs": "^17.7.2"
32 |   },
33 |   "devDependencies": {
34 |     "@types/node": "^20.11.24",
35 |     "@types/yargs": "^17.0.33",
36 |     "typescript": "^5.3.3"
37 |   }
38 | }
39 | 
```

--------------------------------------------------------------------------------
/src/MiroClient.ts:
--------------------------------------------------------------------------------

```typescript
  1 | 
  2 | import fetch from 'node-fetch';
  3 | 
  4 | interface MiroBoard {
  5 |   id: string;
  6 |   name: string;
  7 |   description?: string;
  8 | }
  9 | 
 10 | interface MiroBoardsResponse {
 11 |   data: MiroBoard[];
 12 |   total: number;
 13 |   size: number;
 14 |   offset: number;
 15 | }
 16 | 
 17 | interface MiroItem {
 18 |   id: string;
 19 |   type: string;
 20 |   [key: string]: any;
 21 | }
 22 | 
 23 | interface MiroItemsResponse {
 24 |   data: MiroItem[];
 25 |   cursor?: string;
 26 | }
 27 | 
 28 | export class MiroClient {
 29 |   constructor(private token: string) {}
 30 | 
 31 |   private async fetchApi(path: string, options: { method?: string; body?: any } = {}) {
 32 |     const response = await fetch(`https://api.miro.com/v2${path}`, {
 33 |       method: options.method || 'GET',
 34 |       headers: {
 35 |         'Authorization': `Bearer ${this.token}`,
 36 |         'Content-Type': 'application/json'
 37 |       },
 38 |       ...(options.body ? { body: JSON.stringify(options.body) } : {})
 39 |     });
 40 |     
 41 |     if (!response.ok) {
 42 |       throw new Error(`Miro API error: ${response.status} ${response.statusText}`);
 43 |     }
 44 | 
 45 |     return response.json();
 46 |   }
 47 | 
 48 |   async getBoards(): Promise<MiroBoard[]> {
 49 |     const response = await this.fetchApi('/boards') as MiroBoardsResponse;
 50 |     return response.data;
 51 |   }
 52 | 
 53 |   async getBoardItems(boardId: string): Promise<MiroItem[]> {
 54 |     const response = await this.fetchApi(`/boards/${boardId}/items?limit=50`) as MiroItemsResponse;
 55 |     return response.data;
 56 |   }
 57 | 
 58 |   async createStickyNote(boardId: string, data: any): Promise<MiroItem> {
 59 |     return this.fetchApi(`/boards/${boardId}/sticky_notes`, {
 60 |       method: 'POST',
 61 |       body: data
 62 |     }) as Promise<MiroItem>;
 63 |   }
 64 | 
 65 |   async bulkCreateItems(boardId: string, items: any[]): Promise<MiroItem[]> {
 66 |     const response = await fetch(`https://api.miro.com/v2/boards/${boardId}/items/bulk`, {
 67 |       method: 'POST',
 68 |       headers: {
 69 |         'Authorization': `Bearer ${this.token}`,
 70 |         'Content-Type': 'application/json'
 71 |       },
 72 |       body: JSON.stringify(items)
 73 |     });
 74 |     
 75 |     if (!response.ok) {
 76 |       const error = await response.json() as { message?: string };
 77 |       throw new Error(`Miro API error: ${error.message || response.statusText}`);
 78 |     }
 79 | 
 80 |     const result = await response.json() as { data: MiroItem[] };
 81 |     return result.data || [];
 82 |   }
 83 | 
 84 |   async getFrames(boardId: string): Promise<MiroItem[]> {
 85 |     const response = await this.fetchApi(`/boards/${boardId}/items?type=frame&limit=50`) as MiroItemsResponse;
 86 |     return response.data;
 87 |   }
 88 | 
 89 |   async getItemsInFrame(boardId: string, frameId: string): Promise<MiroItem[]> {
 90 |     const response = await this.fetchApi(`/boards/${boardId}/items?parent_item_id=${frameId}&limit=50`) as MiroItemsResponse;
 91 |     return response.data;
 92 |   }
 93 | 
 94 |   async createShape(boardId: string, data: any): Promise<MiroItem> {
 95 |     return this.fetchApi(`/boards/${boardId}/shapes`, {
 96 |       method: 'POST',
 97 |       body: data
 98 |     }) as Promise<MiroItem>;
 99 |   }
100 | }
```

--------------------------------------------------------------------------------
/prompts/02-boards-as-resources.md:
--------------------------------------------------------------------------------

```markdown
1 | </MIRO_API_1> <MIRO_API_2> "/v2/boards/{board_id}/items": { "get": { "description": "Retrieves a list of items for a specific board. You can retrieve all items on the board, a list of child items inside a parent item, or a list of specific types of items by specifying URL query parameter values.\n\nThis method returns results using a cursor-based approach. A cursor-paginated method returns a portion of the total set of results based on the limit specified and a cursor that points to the next portion of the results. To retrieve the next portion of the collection, on your next call to the same method, set the `cursor` parameter equal to the `cursor` value you received in the response of the previous request. For example, if you set the `limit` query parameter to `10` and the board contains 20 objects, the first call will return information about the first 10 objects in the response along with a cursor parameter and value. In this example, let's say the cursor parameter value returned in the response is `foo`. If you want to retrieve the next set of objects, on your next call to the same method, set the cursor parameter value to `foo`.<br/><h3>Required scope</h3> <a target=_blank href=https://developers.miro.com/reference/scopes>boards:read</a> <br/><h3>Rate limiting</h3> <a target=_blank href=\"/docs/miro-rest-api-introduction#rate-limiting\">Level 2</a><br/>", "operationId": "get-items", "parameters": [ { "in": "query", "name": "limit", "schema": { "type": "string", "default": "10", "description": "The maximum number of results to return per call. If the number of items in the response is greater than the limit specified, the response returns the cursor parameter with a value.", "maximum": 50, "minimum": 10 } }, { "in": "query", "name": "type", "schema": { "type": "string", "enum": [ "text", "shape", "sticky_note", "image", "document", "card", "app_card", "preview", "frame", "embed" ], "description": "If you want to get a list of items of a specific type, specify an item type. For example, if you want to retrieve the list of card items, set `type` to `cards`.\n Possible values: `app_card`, `card`, `document`, `embed`, `frame`, `image`, `shape`, `sticky_note`, `text`" } }, { "in": "query", "name": "cursor", "schema": { "type": "string", "description": "A cursor-paginated method returns a portion of the total set of results based on the limit specified and a `cursor` that points to the next portion of the results. To retrieve the next portion of the collection, set the `cursor` parameter equal to the `cursor` value you received in the response of the previous request." } }, { "description": "Unique identifier (ID) of the board for which you want to retrieve the list of available items.", "in": "path", "name": "board_id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GenericItemCursorPaged" } } }, "description": "Items retrieved" }, "400": { "$ref": "#/components/responses/400" }, "404": { "$ref": "#/components/responses/404" }, "429": { "$ref": "#/components/responses/429" } }, "summary": "Get items on board", "tags": ["items"] } }, </MIRO_API_2>
2 | i would like to expose the available MIRO boards as resources. each board should return it's items as JSON.
3 | 
4 | that will mean calling GetBoards in the MIRO API and for each board calling GetItems. GetItems should return a JSON string which is the Resource content. #file:index.ts
```

--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------

```typescript
  1 | #!/usr/bin/env node
  2 | 
  3 | import yargs from "yargs/yargs";
  4 | import { hideBin } from "yargs/helpers";
  5 | import { MiroClient } from "./MiroClient.js";
  6 | import { Server } from "@modelcontextprotocol/sdk/server/index.js";
  7 | import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
  8 | import {
  9 |   ListResourcesRequestSchema,
 10 |   ReadResourceRequestSchema,
 11 |   ListToolsRequestSchema,
 12 |   CallToolRequestSchema,
 13 |   ListPromptsRequestSchema,
 14 |   GetPromptRequestSchema,
 15 | } from "@modelcontextprotocol/sdk/types.js";
 16 | import fs from 'fs/promises';
 17 | import path from 'path';
 18 | 
 19 | // Parse command line arguments
 20 | const argv = await yargs(hideBin(process.argv))
 21 |   .option("token", {
 22 |     alias: "t",
 23 |     type: "string",
 24 |     description: "Miro OAuth token",
 25 |   })
 26 |   .help().argv;
 27 | 
 28 | // Get token with precedence: command line > environment variable
 29 | const oauthToken = (argv.token as string) || process.env.MIRO_OAUTH_TOKEN;
 30 | 
 31 | if (!oauthToken) {
 32 |   console.error(
 33 |     "Error: Miro OAuth token is required. Provide it via MIRO_OAUTH_TOKEN environment variable or --token argument"
 34 |   );
 35 |   process.exit(1);
 36 | }
 37 | 
 38 | const server = new Server(
 39 |   {
 40 |     name: "mcp-miro",
 41 |     version: "0.1.0",
 42 |   },
 43 |   {
 44 |     capabilities: {
 45 |       resources: {},
 46 |       tools: {},
 47 |       prompts: {},
 48 |     },
 49 |   }
 50 | );
 51 | 
 52 | const miroClient = new MiroClient(oauthToken);
 53 | 
 54 | server.setRequestHandler(ListResourcesRequestSchema, async () => {
 55 |   const boards = await miroClient.getBoards();
 56 | 
 57 |   return {
 58 |     resources: boards.map((board) => ({
 59 |       uri: `miro://board/${board.id}`,
 60 |       mimeType: "application/json",
 61 |       name: board.name,
 62 |       description: board.description || `Miro board: ${board.name}`,
 63 |     })),
 64 |   };
 65 | });
 66 | 
 67 | server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
 68 |   const url = new URL(request.params.uri);
 69 | 
 70 |   if (!request.params.uri.startsWith("miro://board/")) {
 71 |     throw new Error(
 72 |       "Invalid Miro resource URI - must start with miro://board/"
 73 |     );
 74 |   }
 75 | 
 76 |   const boardId = url.pathname.substring(1); // Remove leading slash from pathname
 77 |   const items = await miroClient.getBoardItems(boardId);
 78 | 
 79 |   return {
 80 |     contents: [
 81 |       {
 82 |         uri: request.params.uri,
 83 |         mimeType: "application/json",
 84 |         text: JSON.stringify(items, null, 2),
 85 |       },
 86 |     ],
 87 |   };
 88 | });
 89 | 
 90 | server.setRequestHandler(ListToolsRequestSchema, async () => {
 91 |   return {
 92 |     tools: [
 93 |       {
 94 |         name: "list_boards",
 95 |         description: "List all available Miro boards and their IDs",
 96 |         inputSchema: {
 97 |           type: "object",
 98 |           properties: {},
 99 |         },
100 |       },
101 |       {
102 |         name: "create_sticky_note",
103 |         description:
104 |           "Create a sticky note on a Miro board. By default, sticky notes are 199x228 and available in these colors: gray, light_yellow, yellow, orange, light_green, green, dark_green, cyan, light_pink, pink, violet, red, light_blue, blue, dark_blue, black.",
105 |         inputSchema: {
106 |           type: "object",
107 |           properties: {
108 |             boardId: {
109 |               type: "string",
110 |               description: "ID of the board to create the sticky note on",
111 |             },
112 |             content: {
113 |               type: "string",
114 |               description: "Text content of the sticky note",
115 |             },
116 |             color: {
117 |               type: "string",
118 |               description:
119 |                 "Color of the sticky note (e.g. 'yellow', 'blue', 'pink')",
120 |               enum: [
121 |                 "gray",
122 |                 "light_yellow",
123 |                 "yellow",
124 |                 "orange",
125 |                 "light_green",
126 |                 "green",
127 |                 "dark_green",
128 |                 "cyan",
129 |                 "light_pink",
130 |                 "pink",
131 |                 "violet",
132 |                 "red",
133 |                 "light_blue",
134 |                 "blue",
135 |                 "dark_blue",
136 |                 "black",
137 |               ],
138 |               default: "yellow",
139 |             },
140 |             x: {
141 |               type: "number",
142 |               description: "X coordinate position",
143 |               default: 0,
144 |             },
145 |             y: {
146 |               type: "number",
147 |               description: "Y coordinate position",
148 |               default: 0,
149 |             },
150 |           },
151 |           required: ["boardId", "content"],
152 |         },
153 |       },
154 |       {
155 |         name: "bulk_create_items",
156 |         description:
157 |           "Create multiple items on a Miro board in a single transaction (max 20 items)",
158 |         inputSchema: {
159 |           type: "object",
160 |           properties: {
161 |             boardId: {
162 |               type: "string",
163 |               description: "ID of the board to create the items on",
164 |             },
165 |             items: {
166 |               type: "array",
167 |               description: "Array of items to create",
168 |               items: {
169 |                 type: "object",
170 |                 properties: {
171 |                   type: {
172 |                     type: "string",
173 |                     enum: [
174 |                       "app_card",
175 |                       "text",
176 |                       "shape",
177 |                       "sticky_note",
178 |                       "image",
179 |                       "document",
180 |                       "card",
181 |                       "frame",
182 |                       "embed",
183 |                     ],
184 |                     description: "Type of item to create",
185 |                   },
186 |                   data: {
187 |                     type: "object",
188 |                     description: "Item-specific data configuration",
189 |                   },
190 |                   style: {
191 |                     type: "object",
192 |                     description: "Item-specific style configuration",
193 |                   },
194 |                   position: {
195 |                     type: "object",
196 |                     description: "Item position configuration",
197 |                   },
198 |                   geometry: {
199 |                     type: "object",
200 |                     description: "Item geometry configuration",
201 |                   },
202 |                   parent: {
203 |                     type: "object",
204 |                     description: "Parent item configuration",
205 |                   },
206 |                 },
207 |                 required: ["type"],
208 |               },
209 |               minItems: 1,
210 |               maxItems: 20,
211 |             },
212 |           },
213 |           required: ["boardId", "items"],
214 |         },
215 |       },
216 |       {
217 |         name: "get_frames",
218 |         description: "Get all frames from a Miro board",
219 |         inputSchema: {
220 |           type: "object",
221 |           properties: {
222 |             boardId: {
223 |               type: "string",
224 |               description: "ID of the board to get frames from",
225 |             },
226 |           },
227 |           required: ["boardId"],
228 |         },
229 |       },
230 |       {
231 |         name: "get_items_in_frame",
232 |         description:
233 |           "Get all items contained within a specific frame on a Miro board",
234 |         inputSchema: {
235 |           type: "object",
236 |           properties: {
237 |             boardId: {
238 |               type: "string",
239 |               description: "ID of the board that contains the frame",
240 |             },
241 |             frameId: {
242 |               type: "string",
243 |               description: "ID of the frame to get items from",
244 |             },
245 |           },
246 |           required: ["boardId", "frameId"],
247 |         },
248 |       },
249 |       {
250 |         name: "create_shape",
251 |         description:
252 |           "Create a shape on a Miro board. Available shapes include basic shapes (rectangle, circle, etc.) and flowchart shapes (process, decision, etc.). Standard geometry specs: width and height in pixels (default 200x200)",
253 |         inputSchema: {
254 |           type: "object",
255 |           properties: {
256 |             boardId: {
257 |               type: "string",
258 |               description: "ID of the board to create the shape on",
259 |             },
260 |             content: {
261 |               type: "string",
262 |               description: "Text content to display on the shape",
263 |             },
264 |             shape: {
265 |               type: "string",
266 |               description: "Type of shape to create",
267 |               enum: [
268 |                 // Basic shapes
269 |                 "rectangle",
270 |                 "round_rectangle",
271 |                 "circle",
272 |                 "triangle",
273 |                 "rhombus",
274 |                 "parallelogram",
275 |                 "trapezoid",
276 |                 "pentagon",
277 |                 "hexagon",
278 |                 "octagon",
279 |                 "wedge_round_rectangle_callout",
280 |                 "star",
281 |                 "flow_chart_predefined_process",
282 |                 "cloud",
283 |                 "cross",
284 |                 "can",
285 |                 "right_arrow",
286 |                 "left_arrow",
287 |                 "left_right_arrow",
288 |                 "left_brace",
289 |                 "right_brace",
290 |                 // Flowchart shapes
291 |                 "flow_chart_connector",
292 |                 "flow_chart_magnetic_disk",
293 |                 "flow_chart_input_output",
294 |                 "flow_chart_decision",
295 |                 "flow_chart_delay",
296 |                 "flow_chart_display",
297 |                 "flow_chart_document",
298 |                 "flow_chart_magnetic_drum",
299 |                 "flow_chart_internal_storage",
300 |                 "flow_chart_manual_input",
301 |                 "flow_chart_manual_operation",
302 |                 "flow_chart_merge",
303 |                 "flow_chart_multidocuments",
304 |                 "flow_chart_note_curly_left",
305 |                 "flow_chart_note_curly_right",
306 |                 "flow_chart_note_square",
307 |                 "flow_chart_offpage_connector",
308 |                 "flow_chart_or",
309 |                 "flow_chart_predefined_process_2",
310 |                 "flow_chart_preparation",
311 |                 "flow_chart_process",
312 |                 "flow_chart_online_storage",
313 |                 "flow_chart_summing_junction",
314 |                 "flow_chart_terminator",
315 |               ],
316 |               default: "rectangle",
317 |             },
318 |             style: {
319 |               type: "object",
320 |               description: "Style configuration for the shape",
321 |               properties: {
322 |                 borderColor: { type: "string" },
323 |                 borderOpacity: { type: "number", minimum: 0, maximum: 1 },
324 |                 borderStyle: {
325 |                   type: "string",
326 |                   enum: ["normal", "dotted", "dashed"],
327 |                 },
328 |                 borderWidth: { type: "number", minimum: 1, maximum: 24 },
329 |                 color: { type: "string" },
330 |                 fillColor: { type: "string" },
331 |                 fillOpacity: { type: "number", minimum: 0, maximum: 1 },
332 |                 fontFamily: { type: "string" },
333 |                 fontSize: { type: "number", minimum: 10, maximum: 288 },
334 |                 textAlign: {
335 |                   type: "string",
336 |                   enum: ["left", "center", "right"],
337 |                 },
338 |                 textAlignVertical: {
339 |                   type: "string",
340 |                   enum: ["top", "middle", "bottom"],
341 |                 },
342 |               },
343 |             },
344 |             position: {
345 |               type: "object",
346 |               properties: {
347 |                 x: { type: "number", default: 0 },
348 |                 y: { type: "number", default: 0 },
349 |                 origin: { type: "string", default: "center" },
350 |               },
351 |             },
352 |             geometry: {
353 |               type: "object",
354 |               properties: {
355 |                 width: { type: "number", default: 200 },
356 |                 height: { type: "number", default: 200 },
357 |                 rotation: { type: "number", default: 0 },
358 |               },
359 |             },
360 |           },
361 |           required: ["boardId", "shape"],
362 |         },
363 |       },
364 |     ],
365 |   };
366 | });
367 | 
368 | server.setRequestHandler(CallToolRequestSchema, async (request) => {
369 |   switch (request.params.name) {
370 |     case "list_boards": {
371 |       const boards = await miroClient.getBoards();
372 |       return {
373 |         content: [
374 |           {
375 |             type: "text",
376 |             text: "Here are the available Miro boards:",
377 |           },
378 |           ...boards.map((b) => ({
379 |             type: "text",
380 |             text: `Board ID: ${b.id}, Name: ${b.name}`,
381 |           })),
382 |         ],
383 |       };
384 |     }
385 | 
386 |     case "create_sticky_note": {
387 |       const {
388 |         boardId,
389 |         content,
390 |         color = "yellow",
391 |         x = 0,
392 |         y = 0,
393 |       } = request.params.arguments as any;
394 | 
395 |       const stickyNote = await miroClient.createStickyNote(boardId, {
396 |         data: {
397 |           content: content,
398 |         },
399 |         style: {
400 |           fillColor: color,
401 |         },
402 |         position: {
403 |           x: x,
404 |           y: y,
405 |         },
406 |       });
407 | 
408 |       return {
409 |         content: [
410 |           {
411 |             type: "text",
412 |             text: `Created sticky note ${stickyNote.id} on board ${boardId}`,
413 |           },
414 |         ],
415 |       };
416 |     }
417 | 
418 |     case "bulk_create_items": {
419 |       const { boardId, items } = request.params.arguments as any;
420 | 
421 |       const createdItems = await miroClient.bulkCreateItems(boardId, items);
422 | 
423 |       return {
424 |         content: [
425 |           {
426 |             type: "text",
427 |             text: `Created ${createdItems.length} items on board ${boardId}`,
428 |           },
429 |         ],
430 |       };
431 |     }
432 | 
433 |     case "get_frames": {
434 |       const { boardId } = request.params.arguments as any;
435 |       const frames = await miroClient.getFrames(boardId);
436 | 
437 |       return {
438 |         content: [
439 |           {
440 |             type: "text",
441 |             text: JSON.stringify(frames, null, 2),
442 |           },
443 |         ],
444 |       };
445 |     }
446 | 
447 |     case "get_items_in_frame": {
448 |       const { boardId, frameId } = request.params.arguments as any;
449 |       const items = await miroClient.getItemsInFrame(boardId, frameId);
450 | 
451 |       return {
452 |         content: [
453 |           {
454 |             type: "text",
455 |             text: JSON.stringify(items, null, 2),
456 |           },
457 |         ],
458 |       };
459 |     }
460 | 
461 |     case "create_shape": {
462 |       const { boardId, shape, content, style, position, geometry } = request
463 |         .params.arguments as any;
464 | 
465 |       const shapeItem = await miroClient.createShape(boardId, {
466 |         data: {
467 |           shape: shape,
468 |           content: content,
469 |         },
470 |         style: style || {},
471 |         position: position || { x: 0, y: 0 },
472 |         geometry: geometry || { width: 200, height: 200, rotation: 0 },
473 |       });
474 | 
475 |       return {
476 |         content: [
477 |           {
478 |             type: "text",
479 |             text: `Created ${shape} shape with ID ${shapeItem.id} on board ${boardId}`,
480 |           },
481 |         ],
482 |       };
483 |     }
484 | 
485 |     default:
486 |       throw new Error("Unknown tool");
487 |   }
488 | });
489 | 
490 | server.setRequestHandler(ListPromptsRequestSchema, async () => {
491 |   return {
492 |     prompts: [
493 |       {
494 |         name: "Working with MIRO",
495 |         description: "Basic prompt for working with MIRO boards",
496 |       },
497 |     ],
498 |   };
499 | });
500 | 
501 | server.setRequestHandler(GetPromptRequestSchema, async (request) => {
502 |   if (request.params.name === "Working with MIRO") {
503 |     const keyFactsPath = path.join(process.cwd(), 'resources', 'boards-key-facts.md');
504 |     const keyFacts = await fs.readFile(keyFactsPath, 'utf-8');
505 |     return {
506 |       messages: [
507 |         {
508 |           role: "user",
509 |           content: {
510 |             type: "text",
511 |             text: keyFacts,
512 |           },
513 |         },
514 |       ],
515 |     };
516 |   }
517 |   throw new Error("Unknown prompt");
518 | });
519 | 
520 | async function main() {
521 |   const transport = new StdioServerTransport();
522 |   await server.connect(transport);
523 | }
524 | 
525 | main().catch((error) => {
526 |   console.error("Server error:", error);
527 |   process.exit(1);
528 | });
529 | 
```

--------------------------------------------------------------------------------
/prompts/ref/mcp-types.ts:
--------------------------------------------------------------------------------

```typescript
   1 | import { z } from "zod";
   2 | 
   3 | export const LATEST_PROTOCOL_VERSION = "2024-11-05";
   4 | export const SUPPORTED_PROTOCOL_VERSIONS = [
   5 |   LATEST_PROTOCOL_VERSION,
   6 |   "2024-10-07",
   7 | ];
   8 | 
   9 | /* JSON-RPC types */
  10 | export const JSONRPC_VERSION = "2.0";
  11 | 
  12 | /**
  13 |  * A progress token, used to associate progress notifications with the original request.
  14 |  */
  15 | export const ProgressTokenSchema = z.union([z.string(), z.number().int()]);
  16 | 
  17 | /**
  18 |  * An opaque token used to represent a cursor for pagination.
  19 |  */
  20 | export const CursorSchema = z.string();
  21 | 
  22 | const BaseRequestParamsSchema = z
  23 |   .object({
  24 |     _meta: z.optional(
  25 |       z
  26 |         .object({
  27 |           /**
  28 |            * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
  29 |            */
  30 |           progressToken: z.optional(ProgressTokenSchema),
  31 |         })
  32 |         .passthrough(),
  33 |     ),
  34 |   })
  35 |   .passthrough();
  36 | 
  37 | export const RequestSchema = z.object({
  38 |   method: z.string(),
  39 |   params: z.optional(BaseRequestParamsSchema),
  40 | });
  41 | 
  42 | const BaseNotificationParamsSchema = z
  43 |   .object({
  44 |     /**
  45 |      * This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.
  46 |      */
  47 |     _meta: z.optional(z.object({}).passthrough()),
  48 |   })
  49 |   .passthrough();
  50 | 
  51 | export const NotificationSchema = z.object({
  52 |   method: z.string(),
  53 |   params: z.optional(BaseNotificationParamsSchema),
  54 | });
  55 | 
  56 | export const ResultSchema = z
  57 |   .object({
  58 |     /**
  59 |      * This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
  60 |      */
  61 |     _meta: z.optional(z.object({}).passthrough()),
  62 |   })
  63 |   .passthrough();
  64 | 
  65 | /**
  66 |  * A uniquely identifying ID for a request in JSON-RPC.
  67 |  */
  68 | export const RequestIdSchema = z.union([z.string(), z.number().int()]);
  69 | 
  70 | /**
  71 |  * A request that expects a response.
  72 |  */
  73 | export const JSONRPCRequestSchema = z
  74 |   .object({
  75 |     jsonrpc: z.literal(JSONRPC_VERSION),
  76 |     id: RequestIdSchema,
  77 |   })
  78 |   .merge(RequestSchema)
  79 |   .strict();
  80 | 
  81 | /**
  82 |  * A notification which does not expect a response.
  83 |  */
  84 | export const JSONRPCNotificationSchema = z
  85 |   .object({
  86 |     jsonrpc: z.literal(JSONRPC_VERSION),
  87 |   })
  88 |   .merge(NotificationSchema)
  89 |   .strict();
  90 | 
  91 | /**
  92 |  * A successful (non-error) response to a request.
  93 |  */
  94 | export const JSONRPCResponseSchema = z
  95 |   .object({
  96 |     jsonrpc: z.literal(JSONRPC_VERSION),
  97 |     id: RequestIdSchema,
  98 |     result: ResultSchema,
  99 |   })
 100 |   .strict();
 101 | 
 102 | /**
 103 |  * An incomplete set of error codes that may appear in JSON-RPC responses.
 104 |  */
 105 | export enum ErrorCode {
 106 |   // SDK error codes
 107 |   ConnectionClosed = -1,
 108 |   RequestTimeout = -2,
 109 | 
 110 |   // Standard JSON-RPC error codes
 111 |   ParseError = -32700,
 112 |   InvalidRequest = -32600,
 113 |   MethodNotFound = -32601,
 114 |   InvalidParams = -32602,
 115 |   InternalError = -32603,
 116 | }
 117 | 
 118 | /**
 119 |  * A response to a request that indicates an error occurred.
 120 |  */
 121 | export const JSONRPCErrorSchema = z
 122 |   .object({
 123 |     jsonrpc: z.literal(JSONRPC_VERSION),
 124 |     id: RequestIdSchema,
 125 |     error: z.object({
 126 |       /**
 127 |        * The error type that occurred.
 128 |        */
 129 |       code: z.number().int(),
 130 |       /**
 131 |        * A short description of the error. The message SHOULD be limited to a concise single sentence.
 132 |        */
 133 |       message: z.string(),
 134 |       /**
 135 |        * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
 136 |        */
 137 |       data: z.optional(z.unknown()),
 138 |     }),
 139 |   })
 140 |   .strict();
 141 | 
 142 | export const JSONRPCMessageSchema = z.union([
 143 |   JSONRPCRequestSchema,
 144 |   JSONRPCNotificationSchema,
 145 |   JSONRPCResponseSchema,
 146 |   JSONRPCErrorSchema,
 147 | ]);
 148 | 
 149 | /* Empty result */
 150 | /**
 151 |  * A response that indicates success but carries no data.
 152 |  */
 153 | export const EmptyResultSchema = ResultSchema.strict();
 154 | 
 155 | /* Cancellation */
 156 | /**
 157 |  * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
 158 |  *
 159 |  * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.
 160 |  *
 161 |  * This notification indicates that the result will be unused, so any associated processing SHOULD cease.
 162 |  *
 163 |  * A client MUST NOT attempt to cancel its `initialize` request.
 164 |  */
 165 | export const CancelledNotificationSchema = NotificationSchema.extend({
 166 |   method: z.literal("notifications/cancelled"),
 167 |   params: BaseNotificationParamsSchema.extend({
 168 |     /**
 169 |      * The ID of the request to cancel.
 170 |      *
 171 |      * This MUST correspond to the ID of a request previously issued in the same direction.
 172 |      */
 173 |     requestId: RequestIdSchema,
 174 | 
 175 |     /**
 176 |      * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
 177 |      */
 178 |     reason: z.string().optional(),
 179 |   }),
 180 | });
 181 | 
 182 | /* Initialization */
 183 | /**
 184 |  * Describes the name and version of an MCP implementation.
 185 |  */
 186 | export const ImplementationSchema = z
 187 |   .object({
 188 |     name: z.string(),
 189 |     version: z.string(),
 190 |   })
 191 |   .passthrough();
 192 | 
 193 | /**
 194 |  * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
 195 |  */
 196 | export const ClientCapabilitiesSchema = z
 197 |   .object({
 198 |     /**
 199 |      * Experimental, non-standard capabilities that the client supports.
 200 |      */
 201 |     experimental: z.optional(z.object({}).passthrough()),
 202 |     /**
 203 |      * Present if the client supports sampling from an LLM.
 204 |      */
 205 |     sampling: z.optional(z.object({}).passthrough()),
 206 |     /**
 207 |      * Present if the client supports listing roots.
 208 |      */
 209 |     roots: z.optional(
 210 |       z
 211 |         .object({
 212 |           /**
 213 |            * Whether the client supports issuing notifications for changes to the roots list.
 214 |            */
 215 |           listChanged: z.optional(z.boolean()),
 216 |         })
 217 |         .passthrough(),
 218 |     ),
 219 |   })
 220 |   .passthrough();
 221 | 
 222 | /**
 223 |  * This request is sent from the client to the server when it first connects, asking it to begin initialization.
 224 |  */
 225 | export const InitializeRequestSchema = RequestSchema.extend({
 226 |   method: z.literal("initialize"),
 227 |   params: BaseRequestParamsSchema.extend({
 228 |     /**
 229 |      * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
 230 |      */
 231 |     protocolVersion: z.string(),
 232 |     capabilities: ClientCapabilitiesSchema,
 233 |     clientInfo: ImplementationSchema,
 234 |   }),
 235 | });
 236 | 
 237 | /**
 238 |  * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
 239 |  */
 240 | export const ServerCapabilitiesSchema = z
 241 |   .object({
 242 |     /**
 243 |      * Experimental, non-standard capabilities that the server supports.
 244 |      */
 245 |     experimental: z.optional(z.object({}).passthrough()),
 246 |     /**
 247 |      * Present if the server supports sending log messages to the client.
 248 |      */
 249 |     logging: z.optional(z.object({}).passthrough()),
 250 |     /**
 251 |      * Present if the server offers any prompt templates.
 252 |      */
 253 |     prompts: z.optional(
 254 |       z
 255 |         .object({
 256 |           /**
 257 |            * Whether this server supports issuing notifications for changes to the prompt list.
 258 |            */
 259 |           listChanged: z.optional(z.boolean()),
 260 |         })
 261 |         .passthrough(),
 262 |     ),
 263 |     /**
 264 |      * Present if the server offers any resources to read.
 265 |      */
 266 |     resources: z.optional(
 267 |       z
 268 |         .object({
 269 |           /**
 270 |            * Whether this server supports clients subscribing to resource updates.
 271 |            */
 272 |           subscribe: z.optional(z.boolean()),
 273 | 
 274 |           /**
 275 |            * Whether this server supports issuing notifications for changes to the resource list.
 276 |            */
 277 |           listChanged: z.optional(z.boolean()),
 278 |         })
 279 |         .passthrough(),
 280 |     ),
 281 |     /**
 282 |      * Present if the server offers any tools to call.
 283 |      */
 284 |     tools: z.optional(
 285 |       z
 286 |         .object({
 287 |           /**
 288 |            * Whether this server supports issuing notifications for changes to the tool list.
 289 |            */
 290 |           listChanged: z.optional(z.boolean()),
 291 |         })
 292 |         .passthrough(),
 293 |     ),
 294 |   })
 295 |   .passthrough();
 296 | 
 297 | /**
 298 |  * After receiving an initialize request from the client, the server sends this response.
 299 |  */
 300 | export const InitializeResultSchema = ResultSchema.extend({
 301 |   /**
 302 |    * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
 303 |    */
 304 |   protocolVersion: z.string(),
 305 |   capabilities: ServerCapabilitiesSchema,
 306 |   serverInfo: ImplementationSchema,
 307 | });
 308 | 
 309 | /**
 310 |  * This notification is sent from the client to the server after initialization has finished.
 311 |  */
 312 | export const InitializedNotificationSchema = NotificationSchema.extend({
 313 |   method: z.literal("notifications/initialized"),
 314 | });
 315 | 
 316 | /* Ping */
 317 | /**
 318 |  * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
 319 |  */
 320 | export const PingRequestSchema = RequestSchema.extend({
 321 |   method: z.literal("ping"),
 322 | });
 323 | 
 324 | /* Progress notifications */
 325 | export const ProgressSchema = z
 326 |   .object({
 327 |     /**
 328 |      * The progress thus far. This should increase every time progress is made, even if the total is unknown.
 329 |      */
 330 |     progress: z.number(),
 331 |     /**
 332 |      * Total number of items to process (or total progress required), if known.
 333 |      */
 334 |     total: z.optional(z.number()),
 335 |   })
 336 |   .passthrough();
 337 | 
 338 | /**
 339 |  * An out-of-band notification used to inform the receiver of a progress update for a long-running request.
 340 |  */
 341 | export const ProgressNotificationSchema = NotificationSchema.extend({
 342 |   method: z.literal("notifications/progress"),
 343 |   params: BaseNotificationParamsSchema.merge(ProgressSchema).extend({
 344 |     /**
 345 |      * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
 346 |      */
 347 |     progressToken: ProgressTokenSchema,
 348 |   }),
 349 | });
 350 | 
 351 | /* Pagination */
 352 | export const PaginatedRequestSchema = RequestSchema.extend({
 353 |   params: BaseRequestParamsSchema.extend({
 354 |     /**
 355 |      * An opaque token representing the current pagination position.
 356 |      * If provided, the server should return results starting after this cursor.
 357 |      */
 358 |     cursor: z.optional(CursorSchema),
 359 |   }).optional(),
 360 | });
 361 | 
 362 | export const PaginatedResultSchema = ResultSchema.extend({
 363 |   /**
 364 |    * An opaque token representing the pagination position after the last returned result.
 365 |    * If present, there may be more results available.
 366 |    */
 367 |   nextCursor: z.optional(CursorSchema),
 368 | });
 369 | 
 370 | /* Resources */
 371 | /**
 372 |  * The contents of a specific resource or sub-resource.
 373 |  */
 374 | export const ResourceContentsSchema = z
 375 |   .object({
 376 |     /**
 377 |      * The URI of this resource.
 378 |      */
 379 |     uri: z.string(),
 380 |     /**
 381 |      * The MIME type of this resource, if known.
 382 |      */
 383 |     mimeType: z.optional(z.string()),
 384 |   })
 385 |   .passthrough();
 386 | 
 387 | export const TextResourceContentsSchema = ResourceContentsSchema.extend({
 388 |   /**
 389 |    * The text of the item. This must only be set if the item can actually be represented as text (not binary data).
 390 |    */
 391 |   text: z.string(),
 392 | });
 393 | 
 394 | export const BlobResourceContentsSchema = ResourceContentsSchema.extend({
 395 |   /**
 396 |    * A base64-encoded string representing the binary data of the item.
 397 |    */
 398 |   blob: z.string().base64(),
 399 | });
 400 | 
 401 | /**
 402 |  * A known resource that the server is capable of reading.
 403 |  */
 404 | export const ResourceSchema = z
 405 |   .object({
 406 |     /**
 407 |      * The URI of this resource.
 408 |      */
 409 |     uri: z.string(),
 410 | 
 411 |     /**
 412 |      * A human-readable name for this resource.
 413 |      *
 414 |      * This can be used by clients to populate UI elements.
 415 |      */
 416 |     name: z.string(),
 417 | 
 418 |     /**
 419 |      * A description of what this resource represents.
 420 |      *
 421 |      * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
 422 |      */
 423 |     description: z.optional(z.string()),
 424 | 
 425 |     /**
 426 |      * The MIME type of this resource, if known.
 427 |      */
 428 |     mimeType: z.optional(z.string()),
 429 |   })
 430 |   .passthrough();
 431 | 
 432 | /**
 433 |  * A template description for resources available on the server.
 434 |  */
 435 | export const ResourceTemplateSchema = z
 436 |   .object({
 437 |     /**
 438 |      * A URI template (according to RFC 6570) that can be used to construct resource URIs.
 439 |      */
 440 |     uriTemplate: z.string(),
 441 | 
 442 |     /**
 443 |      * A human-readable name for the type of resource this template refers to.
 444 |      *
 445 |      * This can be used by clients to populate UI elements.
 446 |      */
 447 |     name: z.string(),
 448 | 
 449 |     /**
 450 |      * A description of what this template is for.
 451 |      *
 452 |      * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
 453 |      */
 454 |     description: z.optional(z.string()),
 455 | 
 456 |     /**
 457 |      * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
 458 |      */
 459 |     mimeType: z.optional(z.string()),
 460 |   })
 461 |   .passthrough();
 462 | 
 463 | /**
 464 |  * Sent from the client to request a list of resources the server has.
 465 |  */
 466 | export const ListResourcesRequestSchema = PaginatedRequestSchema.extend({
 467 |   method: z.literal("resources/list"),
 468 | });
 469 | 
 470 | /**
 471 |  * The server's response to a resources/list request from the client.
 472 |  */
 473 | export const ListResourcesResultSchema = PaginatedResultSchema.extend({
 474 |   resources: z.array(ResourceSchema),
 475 | });
 476 | 
 477 | /**
 478 |  * Sent from the client to request a list of resource templates the server has.
 479 |  */
 480 | export const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend(
 481 |   {
 482 |     method: z.literal("resources/templates/list"),
 483 |   },
 484 | );
 485 | 
 486 | /**
 487 |  * The server's response to a resources/templates/list request from the client.
 488 |  */
 489 | export const ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({
 490 |   resourceTemplates: z.array(ResourceTemplateSchema),
 491 | });
 492 | 
 493 | /**
 494 |  * Sent from the client to the server, to read a specific resource URI.
 495 |  */
 496 | export const ReadResourceRequestSchema = RequestSchema.extend({
 497 |   method: z.literal("resources/read"),
 498 |   params: BaseRequestParamsSchema.extend({
 499 |     /**
 500 |      * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.
 501 |      */
 502 |     uri: z.string(),
 503 |   }),
 504 | });
 505 | 
 506 | /**
 507 |  * The server's response to a resources/read request from the client.
 508 |  */
 509 | export const ReadResourceResultSchema = ResultSchema.extend({
 510 |   contents: z.array(
 511 |     z.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
 512 |   ),
 513 | });
 514 | 
 515 | /**
 516 |  * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
 517 |  */
 518 | export const ResourceListChangedNotificationSchema = NotificationSchema.extend({
 519 |   method: z.literal("notifications/resources/list_changed"),
 520 | });
 521 | 
 522 | /**
 523 |  * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
 524 |  */
 525 | export const SubscribeRequestSchema = RequestSchema.extend({
 526 |   method: z.literal("resources/subscribe"),
 527 |   params: BaseRequestParamsSchema.extend({
 528 |     /**
 529 |      * The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.
 530 |      */
 531 |     uri: z.string(),
 532 |   }),
 533 | });
 534 | 
 535 | /**
 536 |  * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
 537 |  */
 538 | export const UnsubscribeRequestSchema = RequestSchema.extend({
 539 |   method: z.literal("resources/unsubscribe"),
 540 |   params: BaseRequestParamsSchema.extend({
 541 |     /**
 542 |      * The URI of the resource to unsubscribe from.
 543 |      */
 544 |     uri: z.string(),
 545 |   }),
 546 | });
 547 | 
 548 | /**
 549 |  * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
 550 |  */
 551 | export const ResourceUpdatedNotificationSchema = NotificationSchema.extend({
 552 |   method: z.literal("notifications/resources/updated"),
 553 |   params: BaseNotificationParamsSchema.extend({
 554 |     /**
 555 |      * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
 556 |      */
 557 |     uri: z.string(),
 558 |   }),
 559 | });
 560 | 
 561 | /* Prompts */
 562 | /**
 563 |  * Describes an argument that a prompt can accept.
 564 |  */
 565 | export const PromptArgumentSchema = z
 566 |   .object({
 567 |     /**
 568 |      * The name of the argument.
 569 |      */
 570 |     name: z.string(),
 571 |     /**
 572 |      * A human-readable description of the argument.
 573 |      */
 574 |     description: z.optional(z.string()),
 575 |     /**
 576 |      * Whether this argument must be provided.
 577 |      */
 578 |     required: z.optional(z.boolean()),
 579 |   })
 580 |   .passthrough();
 581 | 
 582 | /**
 583 |  * A prompt or prompt template that the server offers.
 584 |  */
 585 | export const PromptSchema = z
 586 |   .object({
 587 |     /**
 588 |      * The name of the prompt or prompt template.
 589 |      */
 590 |     name: z.string(),
 591 |     /**
 592 |      * An optional description of what this prompt provides
 593 |      */
 594 |     description: z.optional(z.string()),
 595 |     /**
 596 |      * A list of arguments to use for templating the prompt.
 597 |      */
 598 |     arguments: z.optional(z.array(PromptArgumentSchema)),
 599 |   })
 600 |   .passthrough();
 601 | 
 602 | /**
 603 |  * Sent from the client to request a list of prompts and prompt templates the server has.
 604 |  */
 605 | export const ListPromptsRequestSchema = PaginatedRequestSchema.extend({
 606 |   method: z.literal("prompts/list"),
 607 | });
 608 | 
 609 | /**
 610 |  * The server's response to a prompts/list request from the client.
 611 |  */
 612 | export const ListPromptsResultSchema = PaginatedResultSchema.extend({
 613 |   prompts: z.array(PromptSchema),
 614 | });
 615 | 
 616 | /**
 617 |  * Used by the client to get a prompt provided by the server.
 618 |  */
 619 | export const GetPromptRequestSchema = RequestSchema.extend({
 620 |   method: z.literal("prompts/get"),
 621 |   params: BaseRequestParamsSchema.extend({
 622 |     /**
 623 |      * The name of the prompt or prompt template.
 624 |      */
 625 |     name: z.string(),
 626 |     /**
 627 |      * Arguments to use for templating the prompt.
 628 |      */
 629 |     arguments: z.optional(z.record(z.string())),
 630 |   }),
 631 | });
 632 | 
 633 | /**
 634 |  * Text provided to or from an LLM.
 635 |  */
 636 | export const TextContentSchema = z
 637 |   .object({
 638 |     type: z.literal("text"),
 639 |     /**
 640 |      * The text content of the message.
 641 |      */
 642 |     text: z.string(),
 643 |   })
 644 |   .passthrough();
 645 | 
 646 | /**
 647 |  * An image provided to or from an LLM.
 648 |  */
 649 | export const ImageContentSchema = z
 650 |   .object({
 651 |     type: z.literal("image"),
 652 |     /**
 653 |      * The base64-encoded image data.
 654 |      */
 655 |     data: z.string().base64(),
 656 |     /**
 657 |      * The MIME type of the image. Different providers may support different image types.
 658 |      */
 659 |     mimeType: z.string(),
 660 |   })
 661 |   .passthrough();
 662 | 
 663 | /**
 664 |  * The contents of a resource, embedded into a prompt or tool call result.
 665 |  */
 666 | export const EmbeddedResourceSchema = z
 667 |   .object({
 668 |     type: z.literal("resource"),
 669 |     resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
 670 |   })
 671 |   .passthrough();
 672 | 
 673 | /**
 674 |  * Describes a message returned as part of a prompt.
 675 |  */
 676 | export const PromptMessageSchema = z
 677 |   .object({
 678 |     role: z.enum(["user", "assistant"]),
 679 |     content: z.union([
 680 |       TextContentSchema,
 681 |       ImageContentSchema,
 682 |       EmbeddedResourceSchema,
 683 |     ]),
 684 |   })
 685 |   .passthrough();
 686 | 
 687 | /**
 688 |  * The server's response to a prompts/get request from the client.
 689 |  */
 690 | export const GetPromptResultSchema = ResultSchema.extend({
 691 |   /**
 692 |    * An optional description for the prompt.
 693 |    */
 694 |   description: z.optional(z.string()),
 695 |   messages: z.array(PromptMessageSchema),
 696 | });
 697 | 
 698 | /**
 699 |  * 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.
 700 |  */
 701 | export const PromptListChangedNotificationSchema = NotificationSchema.extend({
 702 |   method: z.literal("notifications/prompts/list_changed"),
 703 | });
 704 | 
 705 | /* Tools */
 706 | /**
 707 |  * Definition for a tool the client can call.
 708 |  */
 709 | export const ToolSchema = z
 710 |   .object({
 711 |     /**
 712 |      * The name of the tool.
 713 |      */
 714 |     name: z.string(),
 715 |     /**
 716 |      * A human-readable description of the tool.
 717 |      */
 718 |     description: z.optional(z.string()),
 719 |     /**
 720 |      * A JSON Schema object defining the expected parameters for the tool.
 721 |      */
 722 |     inputSchema: z
 723 |       .object({
 724 |         type: z.literal("object"),
 725 |         properties: z.optional(z.object({}).passthrough()),
 726 |       })
 727 |       .passthrough(),
 728 |   })
 729 |   .passthrough();
 730 | 
 731 | /**
 732 |  * Sent from the client to request a list of tools the server has.
 733 |  */
 734 | export const ListToolsRequestSchema = PaginatedRequestSchema.extend({
 735 |   method: z.literal("tools/list"),
 736 | });
 737 | 
 738 | /**
 739 |  * The server's response to a tools/list request from the client.
 740 |  */
 741 | export const ListToolsResultSchema = PaginatedResultSchema.extend({
 742 |   tools: z.array(ToolSchema),
 743 | });
 744 | 
 745 | /**
 746 |  * The server's response to a tool call.
 747 |  */
 748 | export const CallToolResultSchema = ResultSchema.extend({
 749 |   content: z.array(
 750 |     z.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema]),
 751 |   ),
 752 |   isError: z.boolean().default(false).optional(),
 753 | });
 754 | 
 755 | /**
 756 |  * CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07.
 757 |  */
 758 | export const CompatibilityCallToolResultSchema = CallToolResultSchema.or(
 759 |   ResultSchema.extend({
 760 |     toolResult: z.unknown(),
 761 |   }),
 762 | );
 763 | 
 764 | /**
 765 |  * Used by the client to invoke a tool provided by the server.
 766 |  */
 767 | export const CallToolRequestSchema = RequestSchema.extend({
 768 |   method: z.literal("tools/call"),
 769 |   params: BaseRequestParamsSchema.extend({
 770 |     name: z.string(),
 771 |     arguments: z.optional(z.record(z.unknown())),
 772 |   }),
 773 | });
 774 | 
 775 | /**
 776 |  * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.
 777 |  */
 778 | export const ToolListChangedNotificationSchema = NotificationSchema.extend({
 779 |   method: z.literal("notifications/tools/list_changed"),
 780 | });
 781 | 
 782 | /* Logging */
 783 | /**
 784 |  * The severity of a log message.
 785 |  */
 786 | export const LoggingLevelSchema = z.enum([
 787 |   "debug",
 788 |   "info",
 789 |   "notice",
 790 |   "warning",
 791 |   "error",
 792 |   "critical",
 793 |   "alert",
 794 |   "emergency",
 795 | ]);
 796 | 
 797 | /**
 798 |  * A request from the client to the server, to enable or adjust logging.
 799 |  */
 800 | export const SetLevelRequestSchema = RequestSchema.extend({
 801 |   method: z.literal("logging/setLevel"),
 802 |   params: BaseRequestParamsSchema.extend({
 803 |     /**
 804 |      * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message.
 805 |      */
 806 |     level: LoggingLevelSchema,
 807 |   }),
 808 | });
 809 | 
 810 | /**
 811 |  * Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.
 812 |  */
 813 | export const LoggingMessageNotificationSchema = NotificationSchema.extend({
 814 |   method: z.literal("notifications/message"),
 815 |   params: BaseNotificationParamsSchema.extend({
 816 |     /**
 817 |      * The severity of this log message.
 818 |      */
 819 |     level: LoggingLevelSchema,
 820 |     /**
 821 |      * An optional name of the logger issuing this message.
 822 |      */
 823 |     logger: z.optional(z.string()),
 824 |     /**
 825 |      * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
 826 |      */
 827 |     data: z.unknown(),
 828 |   }),
 829 | });
 830 | 
 831 | /* Sampling */
 832 | /**
 833 |  * Hints to use for model selection.
 834 |  */
 835 | export const ModelHintSchema = z
 836 |   .object({
 837 |     /**
 838 |      * A hint for a model name.
 839 |      */
 840 |     name: z.string().optional(),
 841 |   })
 842 |   .passthrough();
 843 | 
 844 | /**
 845 |  * The server's preferences for model selection, requested of the client during sampling.
 846 |  */
 847 | export const ModelPreferencesSchema = z
 848 |   .object({
 849 |     /**
 850 |      * Optional hints to use for model selection.
 851 |      */
 852 |     hints: z.optional(z.array(ModelHintSchema)),
 853 |     /**
 854 |      * How much to prioritize cost when selecting a model.
 855 |      */
 856 |     costPriority: z.optional(z.number().min(0).max(1)),
 857 |     /**
 858 |      * How much to prioritize sampling speed (latency) when selecting a model.
 859 |      */
 860 |     speedPriority: z.optional(z.number().min(0).max(1)),
 861 |     /**
 862 |      * How much to prioritize intelligence and capabilities when selecting a model.
 863 |      */
 864 |     intelligencePriority: z.optional(z.number().min(0).max(1)),
 865 |   })
 866 |   .passthrough();
 867 | 
 868 | /**
 869 |  * Describes a message issued to or received from an LLM API.
 870 |  */
 871 | export const SamplingMessageSchema = z
 872 |   .object({
 873 |     role: z.enum(["user", "assistant"]),
 874 |     content: z.union([TextContentSchema, ImageContentSchema]),
 875 |   })
 876 |   .passthrough();
 877 | 
 878 | /**
 879 |  * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.
 880 |  */
 881 | export const CreateMessageRequestSchema = RequestSchema.extend({
 882 |   method: z.literal("sampling/createMessage"),
 883 |   params: BaseRequestParamsSchema.extend({
 884 |     messages: z.array(SamplingMessageSchema),
 885 |     /**
 886 |      * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
 887 |      */
 888 |     systemPrompt: z.optional(z.string()),
 889 |     /**
 890 |      * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
 891 |      */
 892 |     includeContext: z.optional(z.enum(["none", "thisServer", "allServers"])),
 893 |     temperature: z.optional(z.number()),
 894 |     /**
 895 |      * The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.
 896 |      */
 897 |     maxTokens: z.number().int(),
 898 |     stopSequences: z.optional(z.array(z.string())),
 899 |     /**
 900 |      * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
 901 |      */
 902 |     metadata: z.optional(z.object({}).passthrough()),
 903 |     /**
 904 |      * The server's preferences for which model to select.
 905 |      */
 906 |     modelPreferences: z.optional(ModelPreferencesSchema),
 907 |   }),
 908 | });
 909 | 
 910 | /**
 911 |  * The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
 912 |  */
 913 | export const CreateMessageResultSchema = ResultSchema.extend({
 914 |   /**
 915 |    * The name of the model that generated the message.
 916 |    */
 917 |   model: z.string(),
 918 |   /**
 919 |    * The reason why sampling stopped.
 920 |    */
 921 |   stopReason: z.optional(
 922 |     z.enum(["endTurn", "stopSequence", "maxTokens"]).or(z.string()),
 923 |   ),
 924 |   role: z.enum(["user", "assistant"]),
 925 |   content: z.discriminatedUnion("type", [
 926 |     TextContentSchema,
 927 |     ImageContentSchema,
 928 |   ]),
 929 | });
 930 | 
 931 | /* Autocomplete */
 932 | /**
 933 |  * A reference to a resource or resource template definition.
 934 |  */
 935 | export const ResourceReferenceSchema = z
 936 |   .object({
 937 |     type: z.literal("ref/resource"),
 938 |     /**
 939 |      * The URI or URI template of the resource.
 940 |      */
 941 |     uri: z.string(),
 942 |   })
 943 |   .passthrough();
 944 | 
 945 | /**
 946 |  * Identifies a prompt.
 947 |  */
 948 | export const PromptReferenceSchema = z
 949 |   .object({
 950 |     type: z.literal("ref/prompt"),
 951 |     /**
 952 |      * The name of the prompt or prompt template
 953 |      */
 954 |     name: z.string(),
 955 |   })
 956 |   .passthrough();
 957 | 
 958 | /**
 959 |  * A request from the client to the server, to ask for completion options.
 960 |  */
 961 | export const CompleteRequestSchema = RequestSchema.extend({
 962 |   method: z.literal("completion/complete"),
 963 |   params: BaseRequestParamsSchema.extend({
 964 |     ref: z.union([PromptReferenceSchema, ResourceReferenceSchema]),
 965 |     /**
 966 |      * The argument's information
 967 |      */
 968 |     argument: z
 969 |       .object({
 970 |         /**
 971 |          * The name of the argument
 972 |          */
 973 |         name: z.string(),
 974 |         /**
 975 |          * The value of the argument to use for completion matching.
 976 |          */
 977 |         value: z.string(),
 978 |       })
 979 |       .passthrough(),
 980 |   }),
 981 | });
 982 | 
 983 | /**
 984 |  * The server's response to a completion/complete request
 985 |  */
 986 | export const CompleteResultSchema = ResultSchema.extend({
 987 |   completion: z
 988 |     .object({
 989 |       /**
 990 |        * An array of completion values. Must not exceed 100 items.
 991 |        */
 992 |       values: z.array(z.string()).max(100),
 993 |       /**
 994 |        * The total number of completion options available. This can exceed the number of values actually sent in the response.
 995 |        */
 996 |       total: z.optional(z.number().int()),
 997 |       /**
 998 |        * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
 999 |        */
1000 |       hasMore: z.optional(z.boolean()),
1001 |     })
1002 |     .passthrough(),
1003 | });
1004 | 
1005 | /* Roots */
1006 | /**
1007 |  * Represents a root directory or file that the server can operate on.
1008 |  */
1009 | export const RootSchema = z
1010 |   .object({
1011 |     /**
1012 |      * The URI identifying the root. This *must* start with file:// for now.
1013 |      */
1014 |     uri: z.string().startsWith("file://"),
1015 |     /**
1016 |      * An optional name for the root.
1017 |      */
1018 |     name: z.optional(z.string()),
1019 |   })
1020 |   .passthrough();
1021 | 
1022 | /**
1023 |  * Sent from the server to request a list of root URIs from the client.
1024 |  */
1025 | export const ListRootsRequestSchema = RequestSchema.extend({
1026 |   method: z.literal("roots/list"),
1027 | });
1028 | 
1029 | /**
1030 |  * The client's response to a roots/list request from the server.
1031 |  */
1032 | export const ListRootsResultSchema = ResultSchema.extend({
1033 |   roots: z.array(RootSchema),
1034 | });
1035 | 
1036 | /**
1037 |  * A notification from the client to the server, informing it that the list of roots has changed.
1038 |  */
1039 | export const RootsListChangedNotificationSchema = NotificationSchema.extend({
1040 |   method: z.literal("notifications/roots/list_changed"),
1041 | });
1042 | 
1043 | /* Client messages */
1044 | export const ClientRequestSchema = z.union([
1045 |   PingRequestSchema,
1046 |   InitializeRequestSchema,
1047 |   CompleteRequestSchema,
1048 |   SetLevelRequestSchema,
1049 |   GetPromptRequestSchema,
1050 |   ListPromptsRequestSchema,
1051 |   ListResourcesRequestSchema,
1052 |   ListResourceTemplatesRequestSchema,
1053 |   ReadResourceRequestSchema,
1054 |   SubscribeRequestSchema,
1055 |   UnsubscribeRequestSchema,
1056 |   CallToolRequestSchema,
1057 |   ListToolsRequestSchema,
1058 | ]);
1059 | 
1060 | export const ClientNotificationSchema = z.union([
1061 |   CancelledNotificationSchema,
1062 |   ProgressNotificationSchema,
1063 |   InitializedNotificationSchema,
1064 |   RootsListChangedNotificationSchema,
1065 | ]);
1066 | 
1067 | export const ClientResultSchema = z.union([
1068 |   EmptyResultSchema,
1069 |   CreateMessageResultSchema,
1070 |   ListRootsResultSchema,
1071 | ]);
1072 | 
1073 | /* Server messages */
1074 | export const ServerRequestSchema = z.union([
1075 |   PingRequestSchema,
1076 |   CreateMessageRequestSchema,
1077 |   ListRootsRequestSchema,
1078 | ]);
1079 | 
1080 | export const ServerNotificationSchema = z.union([
1081 |   CancelledNotificationSchema,
1082 |   ProgressNotificationSchema,
1083 |   LoggingMessageNotificationSchema,
1084 |   ResourceUpdatedNotificationSchema,
1085 |   ResourceListChangedNotificationSchema,
1086 |   ToolListChangedNotificationSchema,
1087 |   PromptListChangedNotificationSchema,
1088 | ]);
1089 | 
1090 | export const ServerResultSchema = z.union([
1091 |   EmptyResultSchema,
1092 |   InitializeResultSchema,
1093 |   CompleteResultSchema,
1094 |   GetPromptResultSchema,
1095 |   ListPromptsResultSchema,
1096 |   ListResourcesResultSchema,
1097 |   ListResourceTemplatesResultSchema,
1098 |   ReadResourceResultSchema,
1099 |   CallToolResultSchema,
1100 |   ListToolsResultSchema,
1101 | ]);
1102 | 
1103 | export class McpError extends Error {
1104 |   constructor(
1105 |     public readonly code: number,
1106 |     message: string,
1107 |     public readonly data?: unknown,
1108 |   ) {
1109 |     super(`MCP error ${code}: ${message}`);
1110 |   }
1111 | }
1112 | 
1113 | /* JSON-RPC types */
1114 | export type ProgressToken = z.infer<typeof ProgressTokenSchema>;
1115 | export type Cursor = z.infer<typeof CursorSchema>;
1116 | export type Request = z.infer<typeof RequestSchema>;
1117 | export type Notification = z.infer<typeof NotificationSchema>;
1118 | export type Result = z.infer<typeof ResultSchema>;
1119 | export type RequestId = z.infer<typeof RequestIdSchema>;
1120 | export type JSONRPCRequest = z.infer<typeof JSONRPCRequestSchema>;
1121 | export type JSONRPCNotification = z.infer<typeof JSONRPCNotificationSchema>;
1122 | export type JSONRPCResponse = z.infer<typeof JSONRPCResponseSchema>;
1123 | export type JSONRPCError = z.infer<typeof JSONRPCErrorSchema>;
1124 | export type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
1125 | 
1126 | /* Empty result */
1127 | export type EmptyResult = z.infer<typeof EmptyResultSchema>;
1128 | 
1129 | /* Cancellation */
1130 | export type CancelledNotification = z.infer<typeof CancelledNotificationSchema>;
1131 | 
1132 | /* Initialization */
1133 | export type Implementation = z.infer<typeof ImplementationSchema>;
1134 | export type ClientCapabilities = z.infer<typeof ClientCapabilitiesSchema>;
1135 | export type InitializeRequest = z.infer<typeof InitializeRequestSchema>;
1136 | export type ServerCapabilities = z.infer<typeof ServerCapabilitiesSchema>;
1137 | export type InitializeResult = z.infer<typeof InitializeResultSchema>;
1138 | export type InitializedNotification = z.infer<
1139 |   typeof InitializedNotificationSchema
1140 | >;
1141 | 
1142 | /* Ping */
1143 | export type PingRequest = z.infer<typeof PingRequestSchema>;
1144 | 
1145 | /* Progress notifications */
1146 | export type Progress = z.infer<typeof ProgressSchema>;
1147 | export type ProgressNotification = z.infer<typeof ProgressNotificationSchema>;
1148 | 
1149 | /* Pagination */
1150 | export type PaginatedRequest = z.infer<typeof PaginatedRequestSchema>;
1151 | export type PaginatedResult = z.infer<typeof PaginatedResultSchema>;
1152 | 
1153 | /* Resources */
1154 | export type ResourceContents = z.infer<typeof ResourceContentsSchema>;
1155 | export type TextResourceContents = z.infer<typeof TextResourceContentsSchema>;
1156 | export type BlobResourceContents = z.infer<typeof BlobResourceContentsSchema>;
1157 | export type Resource = z.infer<typeof ResourceSchema>;
1158 | export type ResourceTemplate = z.infer<typeof ResourceTemplateSchema>;
1159 | export type ListResourcesRequest = z.infer<typeof ListResourcesRequestSchema>;
1160 | export type ListResourcesResult = z.infer<typeof ListResourcesResultSchema>;
1161 | export type ListResourceTemplatesRequest = z.infer<
1162 |   typeof ListResourceTemplatesRequestSchema
1163 | >;
1164 | export type ListResourceTemplatesResult = z.infer<
1165 |   typeof ListResourceTemplatesResultSchema
1166 | >;
1167 | export type ReadResourceRequest = z.infer<typeof ReadResourceRequestSchema>;
1168 | export type ReadResourceResult = z.infer<typeof ReadResourceResultSchema>;
1169 | export type ResourceListChangedNotification = z.infer<
1170 |   typeof ResourceListChangedNotificationSchema
1171 | >;
1172 | export type SubscribeRequest = z.infer<typeof SubscribeRequestSchema>;
1173 | export type UnsubscribeRequest = z.infer<typeof UnsubscribeRequestSchema>;
1174 | export type ResourceUpdatedNotification = z.infer<
1175 |   typeof ResourceUpdatedNotificationSchema
1176 | >;
1177 | 
1178 | /* Prompts */
1179 | export type PromptArgument = z.infer<typeof PromptArgumentSchema>;
1180 | export type Prompt = z.infer<typeof PromptSchema>;
1181 | export type ListPromptsRequest = z.infer<typeof ListPromptsRequestSchema>;
1182 | export type ListPromptsResult = z.infer<typeof ListPromptsResultSchema>;
1183 | export type GetPromptRequest = z.infer<typeof GetPromptRequestSchema>;
1184 | export type TextContent = z.infer<typeof TextContentSchema>;
1185 | export type ImageContent = z.infer<typeof ImageContentSchema>;
1186 | export type EmbeddedResource = z.infer<typeof EmbeddedResourceSchema>;
1187 | export type PromptMessage = z.infer<typeof PromptMessageSchema>;
1188 | export type GetPromptResult = z.infer<typeof GetPromptResultSchema>;
1189 | export type PromptListChangedNotification = z.infer<
1190 |   typeof PromptListChangedNotificationSchema
1191 | >;
1192 | 
1193 | /* Tools */
1194 | export type Tool = z.infer<typeof ToolSchema>;
1195 | export type ListToolsRequest = z.infer<typeof ListToolsRequestSchema>;
1196 | export type ListToolsResult = z.infer<typeof ListToolsResultSchema>;
1197 | export type CallToolResult = z.infer<typeof CallToolResultSchema>;
1198 | export type CompatibilityCallToolResult = z.infer<
1199 |   typeof CompatibilityCallToolResultSchema
1200 | >;
1201 | export type CallToolRequest = z.infer<typeof CallToolRequestSchema>;
1202 | export type ToolListChangedNotification = z.infer<
1203 |   typeof ToolListChangedNotificationSchema
1204 | >;
1205 | 
1206 | /* Logging */
1207 | export type LoggingLevel = z.infer<typeof LoggingLevelSchema>;
1208 | export type SetLevelRequest = z.infer<typeof SetLevelRequestSchema>;
1209 | export type LoggingMessageNotification = z.infer<
1210 |   typeof LoggingMessageNotificationSchema
1211 | >;
1212 | 
1213 | /* Sampling */
1214 | export type SamplingMessage = z.infer<typeof SamplingMessageSchema>;
1215 | export type CreateMessageRequest = z.infer<typeof CreateMessageRequestSchema>;
1216 | export type CreateMessageResult = z.infer<typeof CreateMessageResultSchema>;
1217 | 
1218 | /* Autocomplete */
1219 | export type ResourceReference = z.infer<typeof ResourceReferenceSchema>;
1220 | export type PromptReference = z.infer<typeof PromptReferenceSchema>;
1221 | export type CompleteRequest = z.infer<typeof CompleteRequestSchema>;
1222 | export type CompleteResult = z.infer<typeof CompleteResultSchema>;
1223 | 
1224 | /* Roots */
1225 | export type Root = z.infer<typeof RootSchema>;
1226 | export type ListRootsRequest = z.infer<typeof ListRootsRequestSchema>;
1227 | export type ListRootsResult = z.infer<typeof ListRootsResultSchema>;
1228 | export type RootsListChangedNotification = z.infer<
1229 |   typeof RootsListChangedNotificationSchema
1230 | >;
1231 | 
1232 | /* Client messages */
1233 | export type ClientRequest = z.infer<typeof ClientRequestSchema>;
1234 | export type ClientNotification = z.infer<typeof ClientNotificationSchema>;
1235 | export type ClientResult = z.infer<typeof ClientResultSchema>;
1236 | 
1237 | /* Server messages */
1238 | export type ServerRequest = z.infer<typeof ServerRequestSchema>;
1239 | export type ServerNotification = z.infer<typeof ServerNotificationSchema>;
1240 | export type ServerResult = z.infer<typeof ServerResultSchema>;
```
Page 1/2FirstPrevNextLast