tmcp 1.7.1 → 1.8.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/src/adapter.d.ts DELETED
@@ -1,16 +0,0 @@
1
- /**
2
- * @import { StandardSchemaV1 } from "@standard-schema/spec";
3
- * @import { JSONSchema7 } from "json-schema";
4
- */
5
- /**
6
- * @template {StandardSchemaV1} TSchema
7
- */
8
- export class JsonSchemaAdapter<TSchema extends StandardSchemaV1> {
9
- /**
10
- * @param {TSchema} schema
11
- * @returns {Promise<JSONSchema7>}
12
- */
13
- toJsonSchema(schema: TSchema): Promise<JSONSchema7>;
14
- }
15
- import type { StandardSchemaV1 } from "@standard-schema/spec";
16
- import type { JSONSchema7 } from "json-schema";
package/src/index.d.ts DELETED
@@ -1,150 +0,0 @@
1
- /**
2
- * @typedef {ClientCapabilitiesType} ClientCapabilities
3
- */
4
- /**
5
- * @template {StandardSchemaV1} StandardSchema
6
- */
7
- export class McpServer<StandardSchema extends StandardSchemaV1> {
8
- /**
9
- * @param {ServerInfo} server_info
10
- * @param {ServerOptions<StandardSchema>} options
11
- */
12
- constructor(server_info: ServerInfo, options: ServerOptions<StandardSchema>);
13
- /**
14
- * @type {Array<{uri: string, name?: string}>}
15
- */
16
- roots: Array<{
17
- uri: string;
18
- name?: string;
19
- }>;
20
- currentClientCapabilities(): {
21
- experimental?: {} & {
22
- [key: string]: unknown;
23
- };
24
- sampling?: {} & {
25
- [key: string]: unknown;
26
- };
27
- elicitation?: {} & {
28
- [key: string]: unknown;
29
- };
30
- roots?: {
31
- listChanged?: boolean;
32
- } & {
33
- [key: string]: unknown;
34
- };
35
- } & {
36
- [key: string]: unknown;
37
- };
38
- /**
39
- * @template {keyof McpEvents} TEvent
40
- * @param {TEvent} event
41
- * @param {McpEvents[TEvent]} callback
42
- * @param {AddEventListenerOptions} [options]
43
- */
44
- on<TEvent extends keyof McpEvents>(event: TEvent, callback: McpEvents[TEvent], options?: AddEventListenerOptions): () => void;
45
- /**
46
- * @template {StandardSchema | undefined} [TSchema=undefined]
47
- * @param {{ name: string; description: string; title?: string; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; annotations?: ToolAnnotations }} options
48
- * @param {TSchema extends undefined ? (()=>Promise<CallToolResult> | CallToolResult) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult> | CallToolResult)} execute
49
- */
50
- tool<TSchema extends StandardSchema | undefined = undefined>({ name, description, title, schema, annotations }: {
51
- name: string;
52
- description: string;
53
- title?: string;
54
- schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never;
55
- annotations?: ToolAnnotations;
56
- }, execute: TSchema extends undefined ? (() => Promise<CallToolResult> | CallToolResult) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult> | CallToolResult)): void;
57
- /**
58
- * @template {StandardSchema | undefined} [TSchema=undefined]
59
- * @param {{ name: string; description: string; title?: string; 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
60
- * @param {TSchema extends undefined ? (()=>Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult} execute
61
- */
62
- prompt<TSchema extends StandardSchema | undefined = undefined>({ name, description, title, schema, complete }: {
63
- name: string;
64
- description: string;
65
- title?: string;
66
- schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never;
67
- complete?: NoInfer<TSchema extends undefined ? never : Partial<Record<keyof StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>, Completion>>>;
68
- }, execute: TSchema extends undefined ? (() => Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult): void;
69
- /**
70
- * @param {{ name: string; description: string; title?: string; uri: string }} options
71
- * @param {(uri: string) => Promise<ReadResourceResult> | ReadResourceResult} execute
72
- */
73
- resource({ name, description, title, uri }: {
74
- name: string;
75
- description: string;
76
- title?: string;
77
- uri: string;
78
- }, execute: (uri: string) => Promise<ReadResourceResult> | ReadResourceResult): void;
79
- /**
80
- * @template {string} TUri
81
- * @template {ExtractURITemplateVariables<TUri>} TVariables
82
- * @param {{ name: string; description: string; title?: string; uri: TUri; complete?: NoInfer<TVariables extends never ? never : Partial<Record<TVariables, Completion>>>; list?: () => Promise<Array<Resource>> | Array<Resource> }} options
83
- * @param {(uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult} execute
84
- */
85
- template<TUri extends string, TVariables extends ExtractURITemplateVariables<TUri>>({ name, description, title, uri, complete, list: list_resources }: {
86
- name: string;
87
- description: string;
88
- title?: string;
89
- uri: TUri;
90
- complete?: NoInfer<TVariables extends never ? never : Partial<Record<TVariables, Completion>>>;
91
- list?: () => Promise<Array<Resource>> | Array<Resource>;
92
- }, execute: (uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult): void;
93
- /**
94
- * @param {JSONRPCResponse | JSONRPCRequest} message
95
- * @param {string} [session_id]
96
- * @returns {ReturnType<JSONRPCServer['receive']> | ReturnType<JSONRPCClient['receive'] | undefined>}
97
- */
98
- receive(message: JSONRPCResponse | JSONRPCRequest, session_id?: string): ReturnType<JSONRPCServer["receive"]> | ReturnType<JSONRPCClient["receive"] | undefined>;
99
- /**
100
- * Send a notification for subscriptions
101
- * @param {SubscriptionsKeys} what
102
- * @param {string} id
103
- */
104
- changed(what: SubscriptionsKeys, id: string): void;
105
- /**
106
- * Refresh roots list from client
107
- */
108
- refreshRoots(): Promise<void>;
109
- /**
110
- * @template {StandardSchema} TSchema
111
- * @param {TSchema} schema
112
- * @returns {Promise<StandardSchemaV1.InferOutput<TSchema>>}
113
- */
114
- elicitation<TSchema extends StandardSchema>(schema: TSchema): Promise<StandardSchemaV1.InferOutput<TSchema>>;
115
- /**
116
- * Request language model sampling from the client
117
- * @param {CreateMessageRequestParams} request
118
- * @returns {Promise<CreateMessageResult>}
119
- */
120
- message(request: CreateMessageRequestParams): Promise<CreateMessageResult>;
121
- /**
122
- * Log a message to the client if logging is enabled and the level is appropriate
123
- * @param {LoggingLevel} level
124
- * @param {unknown} data
125
- * @param {string} [logger]
126
- */
127
- log(level: LoggingLevel, data: unknown, logger?: string): void;
128
- #private;
129
- }
130
- export type ClientCapabilities = ClientCapabilitiesType;
131
- import type { StandardSchemaV1 } from "@standard-schema/spec";
132
- import type { McpEvents } from "./internal/internal.js";
133
- import type { ToolAnnotations } from "./validation/index.js";
134
- import type { CallToolResult } from "./validation/index.js";
135
- import type { Completion } from "./internal/internal.js";
136
- import type { GetPromptResult } from "./validation/index.js";
137
- import type { ReadResourceResult } from "./validation/index.js";
138
- import type { ExtractURITemplateVariables } from "./internal/uri-template.js";
139
- import type { Resource } from "./validation/index.js";
140
- import type { JSONRPCResponse } from "./validation/index.js";
141
- import type { JSONRPCRequest } from "json-rpc-2.0";
142
- import { JSONRPCServer } from 'json-rpc-2.0';
143
- import { JSONRPCClient } from 'json-rpc-2.0';
144
- import type { SubscriptionsKeys } from "./internal/internal.js";
145
- import type { CreateMessageRequestParams } from "./validation/index.js";
146
- import type { CreateMessageResult } from "./validation/index.js";
147
- import type { LoggingLevel } from "./validation/index.js";
148
- import type { ServerInfo } from "./internal/internal.js";
149
- import type { ServerOptions } from "./internal/internal.js";
150
- import type { ClientCapabilities as ClientCapabilitiesType } from "./validation/index.js";