tmcp 1.14.0 → 1.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmcp",
3
- "version": "1.14.0",
3
+ "version": "1.15.1",
4
4
  "description": "The main tmcp library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -4,8 +4,8 @@
4
4
  * @import SqidsType from "sqids";
5
5
  * @import { JSONRPCRequest, JSONRPCParams } from "json-rpc-2.0";
6
6
  * @import { ExtractURITemplateVariables } from "./internal/uri-template.js";
7
- * @import { CallToolResult, ReadResourceResult, GetPromptResult, ClientCapabilities as ClientCapabilitiesType, JSONRPCRequest as JSONRPCRequestType, JSONRPCResponse, CreateMessageRequestParams, CreateMessageResult, Resource, LoggingLevel, ToolAnnotations, ClientInfo, ElicitResult } from "./validation/index.js";
8
- * @import { Tool, Completion, Prompt, StoredResource, ServerOptions, ServerInfo, SubscriptionsKeys, ChangedArgs, McpEvents } from "./internal/internal.js";
7
+ * @import { CallToolResult, ReadResourceResult, GetPromptResult, ServerInfo, ClientCapabilities as ClientCapabilitiesType, JSONRPCRequest as JSONRPCRequestType, JSONRPCResponse, CreateMessageRequestParams, CreateMessageResult, Resource, LoggingLevel, ToolAnnotations, ClientInfo, ElicitResult, Icons as IconsType } from "./validation/index.js";
8
+ * @import { Tool, Completion, Prompt, StoredResource, ServerOptions, SubscriptionsKeys, ChangedArgs, McpEvents } from "./internal/internal.js";
9
9
  */
10
10
  import { JSONRPCClient, JSONRPCServer } from 'json-rpc-2.0';
11
11
  import { AsyncLocalStorage } from 'node:async_hooks';
@@ -53,6 +53,10 @@ import { should_version_negotiation_fail } from './validation/version.js';
53
53
  * @property {TCustom} [custom]
54
54
  */
55
55
 
56
+ /**
57
+ * @typedef {IconsType} Icons
58
+ */
59
+
56
60
  /**
57
61
  * @type {SqidsType | undefined}
58
62
  */
@@ -390,7 +394,7 @@ export class McpServer {
390
394
  name,
391
395
  title: tool.title || tool.description,
392
396
  description: tool.description,
393
-
397
+ icons: tool.icons,
394
398
  inputSchema: tool.schema
395
399
  ? await this.#options.adapter.toJsonSchema(
396
400
  tool.schema,
@@ -507,6 +511,7 @@ export class McpServer {
507
511
  return {
508
512
  name,
509
513
  title: prompt.title || prompt.description,
514
+ icons: prompt.icons,
510
515
  description: prompt.description,
511
516
  arguments: keys.map((key) => {
512
517
  const property =
@@ -598,8 +603,10 @@ export class McpServer {
598
603
  const all_resources = [];
599
604
 
600
605
  // Add static resources
601
- for (const [uri, { description, name, title, ...resource }] of this
602
- .#resources) {
606
+ for (const [
607
+ uri,
608
+ { description, name, title, icons, ...resource },
609
+ ] of this.#resources) {
603
610
  if (!resource.template) {
604
611
  if (
605
612
  resource.enabled != null &&
@@ -611,6 +618,7 @@ export class McpServer {
611
618
  title: title || description,
612
619
  description,
613
620
  uri,
621
+ icons,
614
622
  });
615
623
  } else if (resource.list_resources) {
616
624
  if (
@@ -651,7 +659,14 @@ export class McpServer {
651
659
  [...this.#resources].map(
652
660
  async ([
653
661
  uri,
654
- { description, name, title, template, enabled },
662
+ {
663
+ description,
664
+ name,
665
+ title,
666
+ template,
667
+ icons,
668
+ enabled,
669
+ },
655
670
  ]) => {
656
671
  if (!template) return null;
657
672
  if (
@@ -661,6 +676,7 @@ export class McpServer {
661
676
  return null;
662
677
  return {
663
678
  name,
679
+ icons,
664
680
  title: title || description,
665
681
  description,
666
682
  uriTemplate: uri,
@@ -785,7 +801,7 @@ export class McpServer {
785
801
  * Tools will be invoked by the LLM when it thinks it needs to use them, you can use the annotations to provide additional information about the tool, like what it does, how to use it, etc.
786
802
  * @template {StandardSchema | undefined} [TSchema=undefined]
787
803
  * @template {StandardSchema | undefined} [TOutputSchema=undefined]
788
- * @param {{ name: string; description: string; title?: string; enabled?: ()=>boolean | Promise<boolean>; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; outputSchema?: StandardSchemaV1.InferOutput<TOutputSchema extends undefined ? never : TOutputSchema> extends Record<string, unknown> ? TOutputSchema : never; annotations?: ToolAnnotations }} options
804
+ * @param {{ name: string; description: string; title?: string; enabled?: ()=>boolean | Promise<boolean>; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; outputSchema?: StandardSchemaV1.InferOutput<TOutputSchema extends undefined ? never : TOutputSchema> extends Record<string, unknown> ? TOutputSchema : never; annotations?: ToolAnnotations } & Icons} options
789
805
  * @param {TSchema extends undefined ? (()=>Promise<CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>)} execute
790
806
  */
791
807
  tool(
@@ -797,6 +813,7 @@ export class McpServer {
797
813
  outputSchema,
798
814
  annotations,
799
815
  enabled,
816
+ icons,
800
817
  },
801
818
  execute,
802
819
  ) {
@@ -809,6 +826,7 @@ export class McpServer {
809
826
  outputSchema,
810
827
  execute,
811
828
  annotations,
829
+ icons,
812
830
  });
813
831
  }
814
832
  /**
@@ -818,10 +836,13 @@ export class McpServer {
818
836
  * A prompt can also have a schema that defines the input it expects, the user will be prompted to enter the inputs you request. It can also have a complete function
819
837
  * for each input that will be used to provide completions for the user.
820
838
  * @template {StandardSchema | undefined} [TSchema=undefined]
821
- * @param {{ name: string; description: string; title?: string; enabled?: ()=>boolean | Promise<boolean>; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; complete?: NoInfer<TSchema extends undefined ? never : Partial<Record<keyof (StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>), Completion>>> }} options
839
+ * @param {{ name: string; description: string; title?: string; enabled?: ()=>boolean | Promise<boolean>; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; complete?: NoInfer<TSchema extends undefined ? never : Partial<Record<keyof (StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>), Completion>>> } & Icons} options
822
840
  * @param {TSchema extends undefined ? (()=>Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult} execute
823
841
  */
824
- prompt({ name, description, title, schema, complete, enabled }, execute) {
842
+ prompt(
843
+ { name, description, title, schema, complete, enabled, icons },
844
+ execute,
845
+ ) {
825
846
  if (complete) {
826
847
  this.#completions['ref/prompt'].set(name, complete);
827
848
  }
@@ -832,6 +853,7 @@ export class McpServer {
832
853
  schema,
833
854
  execute,
834
855
  enabled,
856
+ icons,
835
857
  });
836
858
  }
837
859
  /**
@@ -851,10 +873,10 @@ export class McpServer {
851
873
  /**
852
874
  * Add a resource to the server. Resources are added manually to the context by the user to provide the LLM with additional context.
853
875
  * Use the description and title to help the user to understand what the resource is.
854
- * @param {{ name: string; description: string; title?: string; uri: string, enabled?: ()=>boolean | Promise<boolean>; }} options
876
+ * @param {{ name: string; description: string; title?: string; uri: string, enabled?: ()=>boolean | Promise<boolean>; } & Icons} options
855
877
  * @param {(uri: string) => Promise<ReadResourceResult> | ReadResourceResult} execute
856
878
  */
857
- resource({ name, description, title, uri, enabled }, execute) {
879
+ resource({ name, description, title, uri, enabled, icons }, execute) {
858
880
  this.#resource({
859
881
  name,
860
882
  description,
@@ -862,6 +884,7 @@ export class McpServer {
862
884
  uri,
863
885
  execute,
864
886
  enabled,
887
+ icons,
865
888
  template: false,
866
889
  });
867
890
  }
@@ -873,7 +896,7 @@ export class McpServer {
873
896
  * Use the description and title to help the user to understand what the resource is.
874
897
  * @template {string} TUri
875
898
  * @template {ExtractURITemplateVariables<TUri>} TVariables
876
- * @param {{ name: string; description: string; title?: string; enabled?: ()=>boolean | Promise<boolean>; uri: TUri; complete?: NoInfer<TVariables extends never ? never : Partial<Record<TVariables, Completion>>>; list?: () => Promise<Array<Resource>> | Array<Resource> }} options
899
+ * @param {{ name: string; description: string; title?: string; enabled?: ()=>boolean | Promise<boolean>; uri: TUri; complete?: NoInfer<TVariables extends never ? never : Partial<Record<TVariables, Completion>>>; list?: () => Promise<Array<Resource>> | Array<Resource> } & Icons} options
877
900
  * @param {(uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult} execute
878
901
  */
879
902
  template(
@@ -885,6 +908,7 @@ export class McpServer {
885
908
  complete,
886
909
  list: list_resources,
887
910
  enabled,
911
+ icons,
888
912
  },
889
913
  execute,
890
914
  ) {
@@ -896,6 +920,7 @@ export class McpServer {
896
920
  uri,
897
921
  execute,
898
922
  complete,
923
+ icons,
899
924
  list_resources,
900
925
  template: true,
901
926
  });
@@ -10,7 +10,8 @@ import {
10
10
  Resource,
11
11
  ServerCapabilities,
12
12
  LoggingLevel,
13
- ToolAnnotations
13
+ ToolAnnotations,
14
+ Icons
14
15
  } from '../validation/index.js';
15
16
 
16
17
  export type Tool<TSchema extends StandardSchemaV1 = StandardSchemaV1<any>, TOutputSchema extends StandardSchemaV1 = StandardSchemaV1<any>> = {
@@ -23,7 +24,7 @@ export type Tool<TSchema extends StandardSchemaV1 = StandardSchemaV1<any>, TOutp
23
24
  execute: (
24
25
  input?: StandardSchemaV1.InferInput<TSchema>,
25
26
  ) => Promise<CallToolResult> | CallToolResult;
26
- };
27
+ } & Icons;
27
28
 
28
29
  export type Completion = (
29
30
  query: string,
@@ -38,7 +39,7 @@ export type Prompt<TSchema extends StandardSchemaV1 = StandardSchemaV1<any>> = {
38
39
  execute: (
39
40
  input?: StandardSchemaV1.InferInput<TSchema>,
40
41
  ) => Promise<GetPromptResult> | GetPromptResult;
41
- };
42
+ } & Icons;
42
43
 
43
44
  export type StoredResource =
44
45
  | {
@@ -54,7 +55,7 @@ export type StoredResource =
54
55
  uri: string,
55
56
  params: Record<string, string | string[]>,
56
57
  ) => Promise<ReadResourceResult> | ReadResourceResult;
57
- }
58
+ } & Icons
58
59
  | {
59
60
  description: string;
60
61
  name: string;
@@ -64,7 +65,7 @@ export type StoredResource =
64
65
  execute: (
65
66
  uri: string,
66
67
  ) => Promise<ReadResourceResult> | ReadResourceResult;
67
- };
68
+ } & Icons;
68
69
 
69
70
  export type ServerOptions<TSchema extends StandardSchemaV1 | undefined> = {
70
71
  capabilities?: ServerCapabilities;
@@ -79,12 +80,6 @@ export type ServerOptions<TSchema extends StandardSchemaV1 | undefined> = {
79
80
  }
80
81
  };
81
82
 
82
- export type ServerInfo = {
83
- name: string;
84
- version: string;
85
- description: string;
86
- };
87
-
88
83
  export type ChangedArgs = {
89
84
  'resource': [id: string];
90
85
  'tools': [];
@@ -25,7 +25,13 @@ declare module 'tmcp' {
25
25
  * Get the client information (name, version, etc.) of the client that initiated the current request...useful if you want to do something different based on the client.
26
26
  */
27
27
  currentClientInfo(): {
28
+ icons?: {
29
+ src: string;
30
+ mimeType?: string | undefined;
31
+ sizes?: string[] | undefined;
32
+ }[] | undefined;
28
33
  version: string;
34
+ websiteUrl?: string | undefined;
29
35
  name: string;
30
36
  title?: string | undefined;
31
37
  } | undefined;
@@ -48,7 +54,7 @@ declare module 'tmcp' {
48
54
  *
49
55
  * Tools will be invoked by the LLM when it thinks it needs to use them, you can use the annotations to provide additional information about the tool, like what it does, how to use it, etc.
50
56
  * */
51
- tool<TSchema extends StandardSchema | undefined = undefined, TOutputSchema extends StandardSchema | undefined = undefined>({ name, description, title, schema, outputSchema, annotations, enabled, }: {
57
+ tool<TSchema extends StandardSchema | undefined = undefined, TOutputSchema extends StandardSchema | undefined = undefined>({ name, description, title, schema, outputSchema, annotations, enabled, icons, }: {
52
58
  name: string;
53
59
  description: string;
54
60
  title?: string;
@@ -56,7 +62,7 @@ declare module 'tmcp' {
56
62
  schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never;
57
63
  outputSchema?: StandardSchemaV1.InferOutput<TOutputSchema extends undefined ? never : TOutputSchema> extends Record<string, unknown> ? TOutputSchema : never;
58
64
  annotations?: ToolAnnotations;
59
- }, execute: TSchema extends undefined ? (() => Promise<CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>)): void;
65
+ } & Icons, execute: TSchema extends undefined ? (() => Promise<CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>> | CallToolResult<TOutputSchema extends undefined ? undefined : StandardSchemaV1.InferInput<TOutputSchema extends undefined ? never : TOutputSchema>>)): void;
60
66
  /**
61
67
  * Add a prompt to the server. Prompts are used to provide the user with pre-defined messages that adds context to the LLM.
62
68
  * Use the description and title to help the user to understand what the prompt does and when to use it.
@@ -64,25 +70,25 @@ declare module 'tmcp' {
64
70
  * A prompt can also have a schema that defines the input it expects, the user will be prompted to enter the inputs you request. It can also have a complete function
65
71
  * for each input that will be used to provide completions for the user.
66
72
  * */
67
- prompt<TSchema extends StandardSchema | undefined = undefined>({ name, description, title, schema, complete, enabled }: {
73
+ prompt<TSchema extends StandardSchema | undefined = undefined>({ name, description, title, schema, complete, enabled, icons }: {
68
74
  name: string;
69
75
  description: string;
70
76
  title?: string;
71
77
  enabled?: () => boolean | Promise<boolean>;
72
78
  schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never;
73
79
  complete?: NoInfer<TSchema extends undefined ? never : Partial<Record<keyof StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>, Completion>>>;
74
- }, execute: TSchema extends undefined ? (() => Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult): void;
80
+ } & Icons, execute: TSchema extends undefined ? (() => Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult): void;
75
81
  /**
76
82
  * Add a resource to the server. Resources are added manually to the context by the user to provide the LLM with additional context.
77
83
  * Use the description and title to help the user to understand what the resource is.
78
84
  * */
79
- resource({ name, description, title, uri, enabled }: {
85
+ resource({ name, description, title, uri, enabled, icons }: {
80
86
  name: string;
81
87
  description: string;
82
88
  title?: string;
83
89
  uri: string;
84
90
  enabled?: () => boolean | Promise<boolean>;
85
- }, execute: (uri: string) => Promise<ReadResourceResult> | ReadResourceResult): void;
91
+ } & Icons, execute: (uri: string) => Promise<ReadResourceResult> | ReadResourceResult): void;
86
92
  /**
87
93
  * Add a resource template to the server. Resources are added manually to the context by the user to provide the LLM with additional context.
88
94
  * Resource templates are used to create resources dynamically based on a URI template. The URI template should be a valid URI template as defined in RFC 6570.
@@ -90,7 +96,7 @@ declare module 'tmcp' {
90
96
  * be invoked to provide completions for the template variables to the user.
91
97
  * Use the description and title to help the user to understand what the resource is.
92
98
  * */
93
- template<TUri extends string, TVariables extends ExtractURITemplateVariables<TUri>>({ name, description, title, uri, complete, list: list_resources, enabled, }: {
99
+ template<TUri extends string, TVariables extends ExtractURITemplateVariables<TUri>>({ name, description, title, uri, complete, list: list_resources, enabled, icons, }: {
94
100
  name: string;
95
101
  description: string;
96
102
  title?: string;
@@ -98,7 +104,7 @@ declare module 'tmcp' {
98
104
  uri: TUri;
99
105
  complete?: NoInfer<TVariables extends never ? never : Partial<Record<TVariables, Completion>>>;
100
106
  list?: () => Promise<Array<Resource>> | Array<Resource>;
101
- }, execute: (uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult): void;
107
+ } & Icons, execute: (uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult): void;
102
108
  /**
103
109
  * The main function that receive a JSONRpc message and either dispatch a `send` event or process the request.
104
110
  *
@@ -179,6 +185,7 @@ declare module 'tmcp' {
179
185
  auth?: AuthInfo | undefined;
180
186
  custom?: TCustom | undefined;
181
187
  };
188
+ export type Icons = Icons_1;
182
189
  export type ClientCapabilities = ClientCapabilities_1;
183
190
  type Completion = (
184
191
  query: string,
@@ -198,12 +205,6 @@ declare module 'tmcp' {
198
205
  }
199
206
  };
200
207
 
201
- type ServerInfo = {
202
- name: string;
203
- version: string;
204
- description: string;
205
- };
206
-
207
208
  type ChangedArgs = {
208
209
  'resource': [id: string];
209
210
  'tools': [];
@@ -234,6 +235,82 @@ declare module 'tmcp' {
234
235
  readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
235
236
  }, undefined>;
236
237
  }, undefined>;
238
+ const IconsSchema: v.ObjectSchema<{
239
+ /**
240
+ * Optional set of sized icons that the client can display in a user interface.
241
+ *
242
+ * Clients that support rendering icons MUST support at least the following MIME types:
243
+ * - `image/png` - PNG images (safe, universal compatibility)
244
+ * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
245
+ *
246
+ * Clients that support rendering icons SHOULD also support:
247
+ * - `image/svg+xml` - SVG images (scalable but requires security precautions)
248
+ * - `image/webp` - WebP images (modern, efficient format)
249
+ */
250
+ readonly icons: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
251
+ /**
252
+ * URL or data URI for the icon.
253
+ */
254
+ readonly src: v.StringSchema<undefined>;
255
+ /**
256
+ * Optional MIME type for the icon.
257
+ */
258
+ readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
259
+ /**
260
+ * Optional array of strings that specify sizes at which the icon can be used.
261
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
262
+ *
263
+ * If not provided, the client should assume that the icon can be used at any size.
264
+ */
265
+ readonly sizes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
266
+ }, undefined>, undefined>, undefined>;
267
+ }, undefined>;
268
+ /**
269
+ * Describes the name and version of an MCP implementation.
270
+ */
271
+ const ImplementationSchema: v.ObjectSchema<{
272
+ /**
273
+ * Optional set of sized icons that the client can display in a user interface.
274
+ *
275
+ * Clients that support rendering icons MUST support at least the following MIME types:
276
+ * - `image/png` - PNG images (safe, universal compatibility)
277
+ * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
278
+ *
279
+ * Clients that support rendering icons SHOULD also support:
280
+ * - `image/svg+xml` - SVG images (scalable but requires security precautions)
281
+ * - `image/webp` - WebP images (modern, efficient format)
282
+ */
283
+ readonly icons: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
284
+ /**
285
+ * URL or data URI for the icon.
286
+ */
287
+ readonly src: v.StringSchema<undefined>;
288
+ /**
289
+ * Optional MIME type for the icon.
290
+ */
291
+ readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
292
+ /**
293
+ * Optional array of strings that specify sizes at which the icon can be used.
294
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
295
+ *
296
+ * If not provided, the client should assume that the icon can be used at any size.
297
+ */
298
+ readonly sizes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
299
+ }, undefined>, undefined>, undefined>;
300
+ readonly version: v.StringSchema<undefined>;
301
+ readonly websiteUrl: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
302
+ /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
303
+ readonly name: v.StringSchema<undefined>;
304
+ /**
305
+ * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
306
+ * even by those unfamiliar with domain-specific terminology.
307
+ *
308
+ * If not provided, the name should be used for display (except for Tool,
309
+ * where `annotations.title` should be given precedence over using `name`,
310
+ * if present).
311
+ */
312
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
313
+ }, undefined>;
237
314
  /**
238
315
  * 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.
239
316
  */
@@ -289,7 +366,36 @@ declare module 'tmcp' {
289
366
  }, undefined>, undefined>;
290
367
  }, undefined>;
291
368
  readonly clientInfo: v.ObjectSchema<{
369
+ /**
370
+ * Optional set of sized icons that the client can display in a user interface.
371
+ *
372
+ * Clients that support rendering icons MUST support at least the following MIME types:
373
+ * - `image/png` - PNG images (safe, universal compatibility)
374
+ * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
375
+ *
376
+ * Clients that support rendering icons SHOULD also support:
377
+ * - `image/svg+xml` - SVG images (scalable but requires security precautions)
378
+ * - `image/webp` - WebP images (modern, efficient format)
379
+ */
380
+ readonly icons: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
381
+ /**
382
+ * URL or data URI for the icon.
383
+ */
384
+ readonly src: v.StringSchema<undefined>;
385
+ /**
386
+ * Optional MIME type for the icon.
387
+ */
388
+ readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
389
+ /**
390
+ * Optional array of strings that specify sizes at which the icon can be used.
391
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
392
+ *
393
+ * If not provided, the client should assume that the icon can be used at any size.
394
+ */
395
+ readonly sizes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
396
+ }, undefined>, undefined>, undefined>;
292
397
  readonly version: v.StringSchema<undefined>;
398
+ readonly websiteUrl: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
293
399
  /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
294
400
  readonly name: v.StringSchema<undefined>;
295
401
  /**
@@ -361,6 +467,34 @@ declare module 'tmcp' {
361
467
  * A known resource that the server is capable of reading.
362
468
  */
363
469
  const ResourceSchema: v.ObjectSchema<{
470
+ /**
471
+ * Optional set of sized icons that the client can display in a user interface.
472
+ *
473
+ * Clients that support rendering icons MUST support at least the following MIME types:
474
+ * - `image/png` - PNG images (safe, universal compatibility)
475
+ * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
476
+ *
477
+ * Clients that support rendering icons SHOULD also support:
478
+ * - `image/svg+xml` - SVG images (scalable but requires security precautions)
479
+ * - `image/webp` - WebP images (modern, efficient format)
480
+ */
481
+ readonly icons: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
482
+ /**
483
+ * URL or data URI for the icon.
484
+ */
485
+ readonly src: v.StringSchema<undefined>;
486
+ /**
487
+ * Optional MIME type for the icon.
488
+ */
489
+ readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
490
+ /**
491
+ * Optional array of strings that specify sizes at which the icon can be used.
492
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
493
+ *
494
+ * If not provided, the client should assume that the icon can be used at any size.
495
+ */
496
+ readonly sizes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
497
+ }, undefined>, undefined>, undefined>;
364
498
  /**
365
499
  * The URI of this resource.
366
500
  */
@@ -492,6 +626,34 @@ declare module 'tmcp' {
492
626
  readonly _meta: v.OptionalSchema<v.ObjectSchema<{}, undefined>, undefined>;
493
627
  }, undefined>, v.ObjectSchema<{
494
628
  readonly type: v.LiteralSchema<"resource_link", undefined>;
629
+ /**
630
+ * Optional set of sized icons that the client can display in a user interface.
631
+ *
632
+ * Clients that support rendering icons MUST support at least the following MIME types:
633
+ * - `image/png` - PNG images (safe, universal compatibility)
634
+ * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
635
+ *
636
+ * Clients that support rendering icons SHOULD also support:
637
+ * - `image/svg+xml` - SVG images (scalable but requires security precautions)
638
+ * - `image/webp` - WebP images (modern, efficient format)
639
+ */
640
+ readonly icons: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
641
+ /**
642
+ * URL or data URI for the icon.
643
+ */
644
+ readonly src: v.StringSchema<undefined>;
645
+ /**
646
+ * Optional MIME type for the icon.
647
+ */
648
+ readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
649
+ /**
650
+ * Optional array of strings that specify sizes at which the icon can be used.
651
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
652
+ *
653
+ * If not provided, the client should assume that the icon can be used at any size.
654
+ */
655
+ readonly sizes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
656
+ }, undefined>, undefined>, undefined>;
495
657
  /**
496
658
  * The URI of this resource.
497
659
  */
@@ -676,6 +838,34 @@ declare module 'tmcp' {
676
838
  readonly _meta: v.OptionalSchema<v.ObjectSchema<{}, undefined>, undefined>;
677
839
  }, undefined>, v.ObjectSchema<{
678
840
  readonly type: v.LiteralSchema<"resource_link", undefined>;
841
+ /**
842
+ * Optional set of sized icons that the client can display in a user interface.
843
+ *
844
+ * Clients that support rendering icons MUST support at least the following MIME types:
845
+ * - `image/png` - PNG images (safe, universal compatibility)
846
+ * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
847
+ *
848
+ * Clients that support rendering icons SHOULD also support:
849
+ * - `image/svg+xml` - SVG images (scalable but requires security precautions)
850
+ * - `image/webp` - WebP images (modern, efficient format)
851
+ */
852
+ readonly icons: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
853
+ /**
854
+ * URL or data URI for the icon.
855
+ */
856
+ readonly src: v.StringSchema<undefined>;
857
+ /**
858
+ * Optional MIME type for the icon.
859
+ */
860
+ readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
861
+ /**
862
+ * Optional array of strings that specify sizes at which the icon can be used.
863
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
864
+ *
865
+ * If not provided, the client should assume that the icon can be used at any size.
866
+ */
867
+ readonly sizes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
868
+ }, undefined>, undefined>, undefined>;
679
869
  /**
680
870
  * The URI of this resource.
681
871
  */
@@ -982,8 +1172,12 @@ declare module 'tmcp' {
982
1172
  */
983
1173
  readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
984
1174
  }, undefined>;
1175
+ type Icons_1 = v.InferInput<typeof IconsSchema>;
985
1176
  type ClientCapabilities_1 = v.InferInput<typeof ClientCapabilitiesSchema>;
986
1177
  type ServerCapabilities = v.InferInput<typeof ServerCapabilitiesSchema>;
1178
+ type ServerInfo = v.InferInput<typeof ImplementationSchema> & {
1179
+ description?: string;
1180
+ };
987
1181
  type InitializeRequestParams = v.InferInput<typeof InitializeRequestParamsSchema>;
988
1182
  type CallToolResult<TStructuredContent extends Record<string, unknown> | undefined> = Omit<v.InferInput<typeof CallToolResultSchema>, "structuredContent" | "isError"> & (undefined extends TStructuredContent ? {
989
1183
  structuredContent?: undefined;
@@ -3,13 +3,15 @@
3
3
  "file": "index.d.ts",
4
4
  "names": [
5
5
  "McpServer",
6
+ "Icons",
6
7
  "ClientCapabilities",
7
8
  "Completion",
8
9
  "ServerOptions",
9
- "ServerInfo",
10
10
  "ChangedArgs",
11
11
  "McpEvents",
12
12
  "JSONRPCResponseSchema",
13
+ "IconsSchema",
14
+ "ImplementationSchema",
13
15
  "ClientCapabilitiesSchema",
14
16
  "InitializeRequestParamsSchema",
15
17
  "ServerCapabilitiesSchema",
@@ -24,6 +26,7 @@
24
26
  "ElicitResultSchema",
25
27
  "CompleteResultSchema",
26
28
  "ServerCapabilities",
29
+ "ServerInfo",
27
30
  "InitializeRequestParams",
28
31
  "ReadResourceResult",
29
32
  "GetPromptResult",
@@ -57,6 +60,6 @@
57
60
  null,
58
61
  null
59
62
  ],
60
- "mappings": ";;;;;cAuGaA,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aCg2CsCC,kBAAkBA;MC56ClEC,UAAUA;;;;;MAyCVC,aAAaA;;;;;;;;;;;;;MAabC,UAAUA;;;;;;MAMVC,WAAWA;;;;;;;MAaXC,SAASA;;;;;;;;;;;;ODARC,qBAAqBA;;;;;;;;;;;;;;OAuGrBC,wBAAwBA;;;;;;;;;;;;;;;;;;;;;;;OA6BxBC,6BAA6BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuB7BC,wBAAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmMxBC,cAAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4GdC,wBAAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8PxBC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoEpBC,kBAAkBA;OAuGlBC,gCAAgCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8ChCC,yBAAyBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6GzBC,kBAAkBA;;;;;;;;;;;;;;;;;;OAkFlBC,oBAAoBA;;;;;;;;;;;;;;;;;;;;;;;MAiI2BC,kBAAkBA;MAOKC,UAAUA;;;MAG5BC,uBAAuBA;;;;;;;;;;;MAO5BC,kBAAkBA;MAGrBC,eAAeA;MAGhBC,cAAcA;MAGFC,0BAA0BA;MAGjCC,mBAAmBA;MAY9BC,QAAQA;MAMDC,eAAeA;MAGlBC,YAAYA;MAGTC,eAAeA;MAGlBC,YAAYA;;ME/iD7DC,IAAIA;;;;;;;MAOJC,cAAcA;;;;;;;MAOdC,cAAcA;;;;;MAKdC,qBAAqBA;;;;;;;;;;;;;;;;;MAiBrBC,4BAA4BA;;;;;;MAMrBC,2BAA2BA;;;;;;;OCjC1BC,iBAAiBA;;;;;;;;;;;;;;;;cAAjBA,iBAAiBA",
61
64
  "ignoreList": []
62
65
  }
@@ -188,6 +188,43 @@ export const BaseMetadataSchema = v.object({
188
188
  */
189
189
  title: v.optional(v.string()),
190
190
  });
191
+
192
+ /**
193
+ * Icon schema for use in tools, prompts, resources, and implementations.
194
+ */
195
+ export const IconSchema = v.object({
196
+ /**
197
+ * URL or data URI for the icon.
198
+ */
199
+ src: v.string(),
200
+ /**
201
+ * Optional MIME type for the icon.
202
+ */
203
+ mimeType: v.optional(v.string()),
204
+ /**
205
+ * Optional array of strings that specify sizes at which the icon can be used.
206
+ * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG.
207
+ *
208
+ * If not provided, the client should assume that the icon can be used at any size.
209
+ */
210
+ sizes: v.optional(v.array(v.string())),
211
+ });
212
+
213
+ export const IconsSchema = v.object({
214
+ /**
215
+ * Optional set of sized icons that the client can display in a user interface.
216
+ *
217
+ * Clients that support rendering icons MUST support at least the following MIME types:
218
+ * - `image/png` - PNG images (safe, universal compatibility)
219
+ * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)
220
+ *
221
+ * Clients that support rendering icons SHOULD also support:
222
+ * - `image/svg+xml` - SVG images (scalable but requires security precautions)
223
+ * - `image/webp` - WebP images (modern, efficient format)
224
+ */
225
+ icons: v.optional(v.array(IconSchema)),
226
+ });
227
+
191
228
  /* Initialization */
192
229
 
193
230
  /**
@@ -196,6 +233,8 @@ export const BaseMetadataSchema = v.object({
196
233
  export const ImplementationSchema = v.object({
197
234
  ...BaseMetadataSchema.entries,
198
235
  version: v.string(),
236
+ websiteUrl: v.optional(v.string()),
237
+ ...IconsSchema.entries,
199
238
  });
200
239
 
201
240
  /**
@@ -473,6 +512,7 @@ export const ResourceSchema = v.object({
473
512
  * for notes on _meta usage.
474
513
  */
475
514
  _meta: v.optional(v.object({})),
515
+ ...IconsSchema.entries,
476
516
  });
477
517
 
478
518
  /**
@@ -503,6 +543,7 @@ export const ResourceTemplateSchema = v.object({
503
543
  * for notes on _meta usage.
504
544
  */
505
545
  _meta: v.optional(v.object({})),
546
+ ...IconsSchema.entries,
506
547
  });
507
548
 
508
549
  /**
@@ -661,6 +702,7 @@ export const PromptSchema = v.object({
661
702
  * for notes on _meta usage.
662
703
  */
663
704
  _meta: v.optional(v.object({})),
705
+ ...IconsSchema.entries,
664
706
  });
665
707
 
666
708
  /**
@@ -925,6 +967,7 @@ export const ToolSchema = v.object({
925
967
  * for notes on _meta usage.
926
968
  */
927
969
  _meta: v.optional(v.object({})),
970
+ ...IconsSchema.entries,
928
971
  });
929
972
 
930
973
  /**
@@ -1476,6 +1519,9 @@ export const ServerResultSchema = v.union([
1476
1519
  ListToolsResultSchema,
1477
1520
  ]);
1478
1521
 
1522
+ /**
1523
+ * @typedef {v.InferInput<typeof IconsSchema>} Icons
1524
+ */
1479
1525
  /**
1480
1526
  * @typedef {v.InferInput<typeof ClientCapabilitiesSchema>} ClientCapabilities
1481
1527
  */
@@ -1485,8 +1531,9 @@ export const ServerResultSchema = v.union([
1485
1531
  /**
1486
1532
  * @typedef {v.InferInput<typeof ImplementationSchema>} ClientInfo
1487
1533
  */
1534
+ // TODO remove description from ServerInfo on next major...it was never in the protocol
1488
1535
  /**
1489
- * @typedef {v.InferInput<typeof ImplementationSchema>} ServerInfo
1536
+ * @typedef {v.InferInput<typeof ImplementationSchema> & { description?: string }} ServerInfo
1490
1537
  */
1491
1538
  /**
1492
1539
  * @typedef {v.InferInput<typeof InitializeRequestParamsSchema>} InitializeRequestParams