@mastra/mcp 0.10.8 → 0.10.9
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/.turbo/turbo-build.log +2 -21
- package/CHANGELOG.md +25 -0
- package/dist/__fixtures__/fire-crawl-complex-schema.d.ts +5 -0
- package/dist/__fixtures__/fire-crawl-complex-schema.d.ts.map +1 -0
- package/dist/__fixtures__/server-weather.d.ts +2 -0
- package/dist/__fixtures__/server-weather.d.ts.map +1 -0
- package/dist/__fixtures__/stock-price.d.ts +26 -0
- package/dist/__fixtures__/stock-price.d.ts.map +1 -0
- package/dist/__fixtures__/tools.d.ts +15 -0
- package/dist/__fixtures__/tools.d.ts.map +1 -0
- package/dist/__fixtures__/weather.d.ts +4 -0
- package/dist/__fixtures__/weather.d.ts.map +1 -0
- package/dist/client/client.d.ts +225 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/configuration.d.ts +190 -0
- package/dist/client/configuration.d.ts.map +1 -0
- package/dist/client/elicitationActions.d.ts +19 -0
- package/dist/client/elicitationActions.d.ts.map +1 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/promptActions.d.ts +39 -0
- package/dist/client/promptActions.d.ts.map +1 -0
- package/dist/client/resourceActions.d.ts +92 -0
- package/dist/client/resourceActions.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -21
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/promptActions.d.ts +20 -0
- package/dist/server/promptActions.d.ts.map +1 -0
- package/dist/server/resourceActions.d.ts +31 -0
- package/dist/server/resourceActions.d.ts.map +1 -0
- package/dist/server/server.d.ts +196 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/types.d.ts +41 -0
- package/dist/server/types.d.ts.map +1 -0
- package/package.json +5 -5
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +22 -0
- package/dist/_tsup-dts-rollup.d.cts +0 -987
- package/dist/_tsup-dts-rollup.d.ts +0 -987
- package/dist/index.d.cts +0 -21
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/mcp@0.10.
|
|
3
|
-
> tsup
|
|
2
|
+
> @mastra/mcp@0.10.9-alpha.0 build /home/runner/work/mastra/mastra/packages/mcp
|
|
3
|
+
> tsup --silent --config tsup.config.ts
|
|
4
4
|
|
|
5
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.5.0
|
|
8
|
-
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in 22663ms
|
|
10
|
-
[34mDTS[39m Build start
|
|
11
|
-
[34mCLI[39m Target: es2022
|
|
12
|
-
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
|
-
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
|
-
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
|
-
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in 30158ms
|
|
17
|
-
[34mCLI[39m Cleaning output folder
|
|
18
|
-
[34mESM[39m Build start
|
|
19
|
-
[34mCJS[39m Build start
|
|
20
|
-
[32mESM[39m [1mdist/index.js [22m[32m88.94 KB[39m
|
|
21
|
-
[32mESM[39m ⚡️ Build success in 2240ms
|
|
22
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m89.72 KB[39m
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in 2240ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 0.10.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f90797b: dependencies updates:
|
|
8
|
+
- Updated dependency [`@apidevtools/json-schema-ref-parser@^14.1.1` ↗︎](https://www.npmjs.com/package/@apidevtools/json-schema-ref-parser/v/14.1.1) (from `^14.1.0`, in `dependencies`)
|
|
9
|
+
- Updated dependencies [33dcb07]
|
|
10
|
+
- Updated dependencies [d0d9500]
|
|
11
|
+
- Updated dependencies [d30b1a0]
|
|
12
|
+
- Updated dependencies [bff87f7]
|
|
13
|
+
- Updated dependencies [b4a8df0]
|
|
14
|
+
- @mastra/core@0.12.1
|
|
15
|
+
|
|
16
|
+
## 0.10.9-alpha.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- f90797b: dependencies updates:
|
|
21
|
+
- Updated dependency [`@apidevtools/json-schema-ref-parser@^14.1.1` ↗︎](https://www.npmjs.com/package/@apidevtools/json-schema-ref-parser/v/14.1.1) (from `^14.1.0`, in `dependencies`)
|
|
22
|
+
- Updated dependencies [33dcb07]
|
|
23
|
+
- Updated dependencies [d30b1a0]
|
|
24
|
+
- Updated dependencies [bff87f7]
|
|
25
|
+
- Updated dependencies [b4a8df0]
|
|
26
|
+
- @mastra/core@0.12.1-alpha.0
|
|
27
|
+
|
|
3
28
|
## 0.10.8
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fire-crawl-complex-schema.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/fire-crawl-complex-schema.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAs8BrD,eAAO,MAAM,QAAQ,EAAE,UAetB,CAAC;AAEF,eAAO,MAAM,aAAa,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-weather.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/server-weather.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
declare const server: Server<{
|
|
3
|
+
method: string;
|
|
4
|
+
params?: {
|
|
5
|
+
[x: string]: unknown;
|
|
6
|
+
_meta?: {
|
|
7
|
+
[x: string]: unknown;
|
|
8
|
+
progressToken?: string | number | undefined;
|
|
9
|
+
} | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
method: string;
|
|
13
|
+
params?: {
|
|
14
|
+
[x: string]: unknown;
|
|
15
|
+
_meta?: {
|
|
16
|
+
[x: string]: unknown;
|
|
17
|
+
} | undefined;
|
|
18
|
+
} | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
[x: string]: unknown;
|
|
21
|
+
_meta?: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
} | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export { server };
|
|
26
|
+
//# sourceMappingURL=stock-price.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-price.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/stock-price.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAcnE,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;EAUX,CAAC;AAuGF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const weatherTool: import("@mastra/core/tools").Tool<z.ZodObject<{
|
|
3
|
+
location: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
location: string;
|
|
6
|
+
}, {
|
|
7
|
+
location: string;
|
|
8
|
+
}>, undefined, import("@mastra/core").ToolExecutionContext<z.ZodObject<{
|
|
9
|
+
location: z.ZodString;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
location: string;
|
|
12
|
+
}, {
|
|
13
|
+
location: string;
|
|
14
|
+
}>>>;
|
|
15
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,eAAO,MAAM,WAAW;;;;;;;;;;;;IAUtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weather.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/weather.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAgL7C,QAAA,MAAM,SAAS,WAQb,CAAC;AA+EH,OAAO,EAAE,SAAS,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { MastraBase } from '@mastra/core/base';
|
|
2
|
+
import type { RuntimeContext } from '@mastra/core/di';
|
|
3
|
+
import type { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
4
|
+
import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
5
|
+
import type { ClientCapabilities, ElicitRequest, ElicitResult, GetPromptResult, ListPromptsResult, LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
import { ResourceUpdatedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { ElicitationClientActions } from './elicitationActions';
|
|
9
|
+
import { PromptClientActions } from './promptActions';
|
|
10
|
+
import { ResourceClientActions } from './resourceActions';
|
|
11
|
+
export type { LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
|
|
12
|
+
export interface LogMessage {
|
|
13
|
+
level: LoggingLevel;
|
|
14
|
+
message: string;
|
|
15
|
+
timestamp: Date;
|
|
16
|
+
serverName: string;
|
|
17
|
+
details?: Record<string, any>;
|
|
18
|
+
runtimeContext?: RuntimeContext | null;
|
|
19
|
+
}
|
|
20
|
+
export type LogHandler = (logMessage: LogMessage) => void;
|
|
21
|
+
export type ElicitationHandler = (request: ElicitRequest['params']) => Promise<ElicitResult>;
|
|
22
|
+
type BaseServerOptions = {
|
|
23
|
+
logger?: LogHandler;
|
|
24
|
+
timeout?: number;
|
|
25
|
+
capabilities?: ClientCapabilities;
|
|
26
|
+
enableServerLogs?: boolean;
|
|
27
|
+
};
|
|
28
|
+
type StdioServerDefinition = BaseServerOptions & {
|
|
29
|
+
command: string;
|
|
30
|
+
args?: string[];
|
|
31
|
+
env?: Record<string, string>;
|
|
32
|
+
url?: never;
|
|
33
|
+
requestInit?: never;
|
|
34
|
+
eventSourceInit?: never;
|
|
35
|
+
reconnectionOptions?: never;
|
|
36
|
+
sessionId?: never;
|
|
37
|
+
};
|
|
38
|
+
type HttpServerDefinition = BaseServerOptions & {
|
|
39
|
+
url: URL;
|
|
40
|
+
command?: never;
|
|
41
|
+
args?: never;
|
|
42
|
+
env?: never;
|
|
43
|
+
requestInit?: StreamableHTTPClientTransportOptions['requestInit'];
|
|
44
|
+
eventSourceInit?: SSEClientTransportOptions['eventSourceInit'];
|
|
45
|
+
reconnectionOptions?: StreamableHTTPClientTransportOptions['reconnectionOptions'];
|
|
46
|
+
sessionId?: StreamableHTTPClientTransportOptions['sessionId'];
|
|
47
|
+
};
|
|
48
|
+
export type MastraMCPServerDefinition = StdioServerDefinition | HttpServerDefinition;
|
|
49
|
+
export type InternalMastraMCPClientOptions = {
|
|
50
|
+
name: string;
|
|
51
|
+
server: MastraMCPServerDefinition;
|
|
52
|
+
capabilities?: ClientCapabilities;
|
|
53
|
+
version?: string;
|
|
54
|
+
timeout?: number;
|
|
55
|
+
};
|
|
56
|
+
export declare class InternalMastraMCPClient extends MastraBase {
|
|
57
|
+
name: string;
|
|
58
|
+
private client;
|
|
59
|
+
private readonly timeout;
|
|
60
|
+
private logHandler?;
|
|
61
|
+
private enableServerLogs?;
|
|
62
|
+
private serverConfig;
|
|
63
|
+
private transport?;
|
|
64
|
+
private currentOperationContext;
|
|
65
|
+
readonly resources: ResourceClientActions;
|
|
66
|
+
readonly prompts: PromptClientActions;
|
|
67
|
+
readonly elicitation: ElicitationClientActions;
|
|
68
|
+
constructor({ name, version, server, capabilities, timeout, }: InternalMastraMCPClientOptions);
|
|
69
|
+
/**
|
|
70
|
+
* Log a message at the specified level
|
|
71
|
+
* @param level Log level
|
|
72
|
+
* @param message Log message
|
|
73
|
+
* @param details Optional additional details
|
|
74
|
+
*/
|
|
75
|
+
private log;
|
|
76
|
+
private setupLogging;
|
|
77
|
+
private connectStdio;
|
|
78
|
+
private connectHttp;
|
|
79
|
+
private isConnected;
|
|
80
|
+
connect(): Promise<boolean>;
|
|
81
|
+
/**
|
|
82
|
+
* Get the current session ID if using the Streamable HTTP transport.
|
|
83
|
+
* Returns undefined if not connected or not using Streamable HTTP.
|
|
84
|
+
*/
|
|
85
|
+
get sessionId(): string | undefined;
|
|
86
|
+
disconnect(): Promise<void>;
|
|
87
|
+
listResources(): Promise<z.objectOutputType<{
|
|
88
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
89
|
+
} & {
|
|
90
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
91
|
+
} & {
|
|
92
|
+
resources: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
|
|
93
|
+
name: z.ZodString;
|
|
94
|
+
title: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, {
|
|
96
|
+
uri: z.ZodString;
|
|
97
|
+
description: z.ZodOptional<z.ZodString>;
|
|
98
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
99
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
100
|
+
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
101
|
+
name: z.ZodString;
|
|
102
|
+
title: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, {
|
|
104
|
+
uri: z.ZodString;
|
|
105
|
+
description: z.ZodOptional<z.ZodString>;
|
|
106
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
107
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
108
|
+
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
109
|
+
name: z.ZodString;
|
|
110
|
+
title: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, {
|
|
112
|
+
uri: z.ZodString;
|
|
113
|
+
description: z.ZodOptional<z.ZodString>;
|
|
114
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
115
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
116
|
+
}>, z.ZodTypeAny, "passthrough">>, "many">;
|
|
117
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
118
|
+
readResource(uri: string): Promise<z.objectOutputType<{
|
|
119
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
120
|
+
} & {
|
|
121
|
+
contents: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
122
|
+
uri: z.ZodString;
|
|
123
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
124
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
125
|
+
}, {
|
|
126
|
+
text: z.ZodString;
|
|
127
|
+
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
128
|
+
uri: z.ZodString;
|
|
129
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
130
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
131
|
+
}, {
|
|
132
|
+
text: z.ZodString;
|
|
133
|
+
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
134
|
+
uri: z.ZodString;
|
|
135
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
136
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
137
|
+
}, {
|
|
138
|
+
text: z.ZodString;
|
|
139
|
+
}>, z.ZodTypeAny, "passthrough">>, z.ZodObject<z.objectUtil.extendShape<{
|
|
140
|
+
uri: z.ZodString;
|
|
141
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
142
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
143
|
+
}, {
|
|
144
|
+
blob: z.ZodString;
|
|
145
|
+
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
146
|
+
uri: z.ZodString;
|
|
147
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
148
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
149
|
+
}, {
|
|
150
|
+
blob: z.ZodString;
|
|
151
|
+
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
152
|
+
uri: z.ZodString;
|
|
153
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
154
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
155
|
+
}, {
|
|
156
|
+
blob: z.ZodString;
|
|
157
|
+
}>, z.ZodTypeAny, "passthrough">>]>, "many">;
|
|
158
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
159
|
+
subscribeResource(uri: string): Promise<{}>;
|
|
160
|
+
unsubscribeResource(uri: string): Promise<{}>;
|
|
161
|
+
listResourceTemplates(): Promise<z.objectOutputType<{
|
|
162
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
163
|
+
} & {
|
|
164
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
165
|
+
} & {
|
|
166
|
+
resourceTemplates: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
|
|
167
|
+
name: z.ZodString;
|
|
168
|
+
title: z.ZodOptional<z.ZodString>;
|
|
169
|
+
}, {
|
|
170
|
+
uriTemplate: z.ZodString;
|
|
171
|
+
description: z.ZodOptional<z.ZodString>;
|
|
172
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
173
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
174
|
+
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
175
|
+
name: z.ZodString;
|
|
176
|
+
title: z.ZodOptional<z.ZodString>;
|
|
177
|
+
}, {
|
|
178
|
+
uriTemplate: z.ZodString;
|
|
179
|
+
description: z.ZodOptional<z.ZodString>;
|
|
180
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
181
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
182
|
+
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
title: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, {
|
|
186
|
+
uriTemplate: z.ZodString;
|
|
187
|
+
description: z.ZodOptional<z.ZodString>;
|
|
188
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
189
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
190
|
+
}>, z.ZodTypeAny, "passthrough">>, "many">;
|
|
191
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
192
|
+
/**
|
|
193
|
+
* Fetch the list of available prompts from the MCP server.
|
|
194
|
+
*/
|
|
195
|
+
listPrompts(): Promise<ListPromptsResult>;
|
|
196
|
+
/**
|
|
197
|
+
* Get a prompt and its dynamic messages from the server.
|
|
198
|
+
* @param name The prompt name
|
|
199
|
+
* @param args Arguments for the prompt
|
|
200
|
+
* @param version (optional) The prompt version to retrieve
|
|
201
|
+
*/
|
|
202
|
+
getPrompt({ name, args, version, }: {
|
|
203
|
+
name: string;
|
|
204
|
+
args?: Record<string, any>;
|
|
205
|
+
version?: string;
|
|
206
|
+
}): Promise<GetPromptResult>;
|
|
207
|
+
/**
|
|
208
|
+
* Register a handler to be called when the prompt list changes on the server.
|
|
209
|
+
* Use this to refresh cached prompt lists in the client/UI if needed.
|
|
210
|
+
*/
|
|
211
|
+
setPromptListChangedNotificationHandler(handler: () => void): void;
|
|
212
|
+
setResourceUpdatedNotificationHandler(handler: (params: z.infer<typeof ResourceUpdatedNotificationSchema>['params']) => void): void;
|
|
213
|
+
setResourceListChangedNotificationHandler(handler: () => void): void;
|
|
214
|
+
setElicitationRequestHandler(handler: ElicitationHandler): void;
|
|
215
|
+
private convertInputSchema;
|
|
216
|
+
private convertOutputSchema;
|
|
217
|
+
tools(): Promise<Record<string, any>>;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* @deprecated MastraMCPClient is deprecated and will be removed in a future release. Please use MCPClient instead.
|
|
221
|
+
*/
|
|
222
|
+
export declare class MastraMCPClient extends InternalMastraMCPClient {
|
|
223
|
+
constructor(args: InternalMastraMCPClientOptions);
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAGzF,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,oDAAoD,CAAC;AAG/G,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,iBAAi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E,kBAAkB,GAAG,IAAI;YAQjD,kBAAkB;YAoClB,mBAAmB;IAqC3B,KAAK;CAwDZ;AAED;;GAEG;AAEH,qBAAa,eAAgB,SAAQ,uBAAuB;gBAC9C,IAAI,EAAE,8BAA8B;CAMjD"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { MastraBase } from '@mastra/core/base';
|
|
2
|
+
import type { ElicitRequest, ElicitResult, Prompt, Resource, ResourceTemplate } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import type { MastraMCPServerDefinition } from './client';
|
|
4
|
+
export interface MCPClientOptions {
|
|
5
|
+
id?: string;
|
|
6
|
+
servers: Record<string, MastraMCPServerDefinition>;
|
|
7
|
+
timeout?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class MCPClient extends MastraBase {
|
|
10
|
+
private serverConfigs;
|
|
11
|
+
private id;
|
|
12
|
+
private defaultTimeout;
|
|
13
|
+
private mcpClientsById;
|
|
14
|
+
private disconnectPromise;
|
|
15
|
+
constructor(args: MCPClientOptions);
|
|
16
|
+
get elicitation(): {
|
|
17
|
+
onRequest: (serverName: string, handler: (request: ElicitRequest["params"]) => Promise<ElicitResult>) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
get resources(): {
|
|
20
|
+
list: () => Promise<Record<string, Resource[]>>;
|
|
21
|
+
templates: () => Promise<Record<string, ResourceTemplate[]>>;
|
|
22
|
+
read: (serverName: string, uri: string) => Promise<import("zod").objectOutputType<{
|
|
23
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
24
|
+
} & {
|
|
25
|
+
contents: import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
26
|
+
uri: import("zod").ZodString;
|
|
27
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
28
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
29
|
+
}, {
|
|
30
|
+
text: import("zod").ZodString;
|
|
31
|
+
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
|
32
|
+
uri: import("zod").ZodString;
|
|
33
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
34
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
35
|
+
}, {
|
|
36
|
+
text: import("zod").ZodString;
|
|
37
|
+
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
|
38
|
+
uri: import("zod").ZodString;
|
|
39
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
40
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
41
|
+
}, {
|
|
42
|
+
text: import("zod").ZodString;
|
|
43
|
+
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
44
|
+
uri: import("zod").ZodString;
|
|
45
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
46
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
47
|
+
}, {
|
|
48
|
+
blob: import("zod").ZodString;
|
|
49
|
+
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
|
50
|
+
uri: import("zod").ZodString;
|
|
51
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
52
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
53
|
+
}, {
|
|
54
|
+
blob: import("zod").ZodString;
|
|
55
|
+
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
|
56
|
+
uri: import("zod").ZodString;
|
|
57
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
58
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
59
|
+
}, {
|
|
60
|
+
blob: import("zod").ZodString;
|
|
61
|
+
}>, import("zod").ZodTypeAny, "passthrough">>]>, "many">;
|
|
62
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
63
|
+
subscribe: (serverName: string, uri: string) => Promise<{}>;
|
|
64
|
+
unsubscribe: (serverName: string, uri: string) => Promise<{}>;
|
|
65
|
+
onUpdated: (serverName: string, handler: (params: {
|
|
66
|
+
uri: string;
|
|
67
|
+
}) => void) => Promise<void>;
|
|
68
|
+
onListChanged: (serverName: string, handler: () => void) => Promise<void>;
|
|
69
|
+
};
|
|
70
|
+
get prompts(): {
|
|
71
|
+
list: () => Promise<Record<string, Prompt[]>>;
|
|
72
|
+
get: ({ serverName, name, args, version }: {
|
|
73
|
+
serverName: string;
|
|
74
|
+
name: string;
|
|
75
|
+
args?: Record<string, any>;
|
|
76
|
+
version?: string;
|
|
77
|
+
}) => Promise<{
|
|
78
|
+
[x: string]: unknown;
|
|
79
|
+
messages: {
|
|
80
|
+
[x: string]: unknown;
|
|
81
|
+
content: {
|
|
82
|
+
[x: string]: unknown;
|
|
83
|
+
type: "text";
|
|
84
|
+
text: string;
|
|
85
|
+
_meta?: {
|
|
86
|
+
[x: string]: unknown;
|
|
87
|
+
} | undefined;
|
|
88
|
+
} | {
|
|
89
|
+
[x: string]: unknown;
|
|
90
|
+
type: "image";
|
|
91
|
+
data: string;
|
|
92
|
+
mimeType: string;
|
|
93
|
+
_meta?: {
|
|
94
|
+
[x: string]: unknown;
|
|
95
|
+
} | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
[x: string]: unknown;
|
|
98
|
+
type: "audio";
|
|
99
|
+
data: string;
|
|
100
|
+
mimeType: string;
|
|
101
|
+
_meta?: {
|
|
102
|
+
[x: string]: unknown;
|
|
103
|
+
} | undefined;
|
|
104
|
+
} | {
|
|
105
|
+
[x: string]: unknown;
|
|
106
|
+
type: "resource_link";
|
|
107
|
+
name: string;
|
|
108
|
+
uri: string;
|
|
109
|
+
_meta?: {
|
|
110
|
+
[x: string]: unknown;
|
|
111
|
+
} | undefined;
|
|
112
|
+
title?: string | undefined;
|
|
113
|
+
description?: string | undefined;
|
|
114
|
+
mimeType?: string | undefined;
|
|
115
|
+
} | {
|
|
116
|
+
[x: string]: unknown;
|
|
117
|
+
type: "resource";
|
|
118
|
+
resource: {
|
|
119
|
+
[x: string]: unknown;
|
|
120
|
+
text: string;
|
|
121
|
+
uri: string;
|
|
122
|
+
_meta?: {
|
|
123
|
+
[x: string]: unknown;
|
|
124
|
+
} | undefined;
|
|
125
|
+
mimeType?: string | undefined;
|
|
126
|
+
} | {
|
|
127
|
+
[x: string]: unknown;
|
|
128
|
+
uri: string;
|
|
129
|
+
blob: string;
|
|
130
|
+
_meta?: {
|
|
131
|
+
[x: string]: unknown;
|
|
132
|
+
} | undefined;
|
|
133
|
+
mimeType?: string | undefined;
|
|
134
|
+
};
|
|
135
|
+
_meta?: {
|
|
136
|
+
[x: string]: unknown;
|
|
137
|
+
} | undefined;
|
|
138
|
+
};
|
|
139
|
+
role: "user" | "assistant";
|
|
140
|
+
}[];
|
|
141
|
+
_meta?: {
|
|
142
|
+
[x: string]: unknown;
|
|
143
|
+
} | undefined;
|
|
144
|
+
description?: string | undefined;
|
|
145
|
+
}>;
|
|
146
|
+
onListChanged: (serverName: string, handler: () => void) => Promise<void>;
|
|
147
|
+
};
|
|
148
|
+
private addToInstanceCache;
|
|
149
|
+
private makeId;
|
|
150
|
+
disconnect(): Promise<void>;
|
|
151
|
+
getTools(): Promise<Record<string, any>>;
|
|
152
|
+
getToolsets(): Promise<Record<string, Record<string, any>>>;
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated all resource actions have been moved to the this.resources object. Use this.resources.list() instead.
|
|
155
|
+
*/
|
|
156
|
+
getResources(): Promise<Record<string, {
|
|
157
|
+
[x: string]: unknown;
|
|
158
|
+
name: string;
|
|
159
|
+
uri: string;
|
|
160
|
+
_meta?: {
|
|
161
|
+
[x: string]: unknown;
|
|
162
|
+
} | undefined;
|
|
163
|
+
title?: string | undefined;
|
|
164
|
+
description?: string | undefined;
|
|
165
|
+
mimeType?: string | undefined;
|
|
166
|
+
}[]>>;
|
|
167
|
+
/**
|
|
168
|
+
* Get the current session IDs for all connected MCP clients using the Streamable HTTP transport.
|
|
169
|
+
* Returns an object mapping server names to their session IDs.
|
|
170
|
+
*/
|
|
171
|
+
get sessionIds(): Record<string, string>;
|
|
172
|
+
private getConnectedClient;
|
|
173
|
+
private getConnectedClientForServer;
|
|
174
|
+
private eachClientTools;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @deprecated MCPConfigurationOptions is deprecated and will be removed in a future release. Use MCPClientOptions instead.
|
|
178
|
+
*/
|
|
179
|
+
export interface MCPConfigurationOptions {
|
|
180
|
+
id?: string;
|
|
181
|
+
servers: Record<string, MastraMCPServerDefinition>;
|
|
182
|
+
timeout?: number;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* @deprecated MCPConfiguration is deprecated and will be removed in a future release. Use MCPClient instead.
|
|
186
|
+
*/
|
|
187
|
+
export declare class MCPConfiguration extends MCPClient {
|
|
188
|
+
constructor(args: MCPClientOptions);
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/client/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAI1H,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAI1D,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,SAAU,SAAQ,UAAU;IACvC,OAAO,CAAC,aAAa,CAAiD;IACtE,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,iBAAiB,CAA8B;gBAE3C,IAAI,EAAE,gBAAgB;IA0ClC,IAAW,WAAW;gCAGY,MAAM,WAAW,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC;MAgB7G;IAED,IAAW,SAAS;oBAGA,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;yBAqB9B,OAAO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@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IMastraLogger } from "@mastra/core/logger";
|
|
2
|
+
import type { ElicitRequest, ElicitResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { InternalMastraMCPClient } from "./client";
|
|
4
|
+
interface ElicitationClientActionsConfig {
|
|
5
|
+
client: InternalMastraMCPClient;
|
|
6
|
+
logger: IMastraLogger;
|
|
7
|
+
}
|
|
8
|
+
export declare class ElicitationClientActions {
|
|
9
|
+
private readonly client;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
constructor({ client, logger }: ElicitationClientActionsConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Set a handler for elicitation requests.
|
|
14
|
+
* @param handler The callback function to handle the elicitation request.
|
|
15
|
+
*/
|
|
16
|
+
onRequest(handler: (request: ElicitRequest['params']) => Promise<ElicitResult>): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=elicitationActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elicitationActions.d.ts","sourceRoot":"","sources":["../../src/client/elicitationActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,UAAU,8BAA8B;IACtC,MAAM,EAAE,uBAAuB,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;gBAE3B,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,8BAA8B;IAK9D;;;OAGG;IACI,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;CAG7F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACpH,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { IMastraLogger } from "@mastra/core/logger";
|
|
2
|
+
import type { GetPromptResult, Prompt } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { InternalMastraMCPClient } from "./client";
|
|
4
|
+
interface PromptClientActionsConfig {
|
|
5
|
+
client: InternalMastraMCPClient;
|
|
6
|
+
logger: IMastraLogger;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Client-side prompt actions for listing, getting, and subscribing to prompt changes.
|
|
10
|
+
*/
|
|
11
|
+
export declare class PromptClientActions {
|
|
12
|
+
private readonly client;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
constructor({ client, logger }: PromptClientActionsConfig);
|
|
15
|
+
/**
|
|
16
|
+
* Get all prompts from the connected MCP server.
|
|
17
|
+
* @returns A list of prompts with their versions.
|
|
18
|
+
*/
|
|
19
|
+
list(): Promise<Prompt[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a specific prompt.
|
|
22
|
+
* @param name The name of the prompt to get.
|
|
23
|
+
* @param args Optional arguments for the prompt.
|
|
24
|
+
* @param version Optional version of the prompt to get.
|
|
25
|
+
* @returns The prompt content.
|
|
26
|
+
*/
|
|
27
|
+
get({ name, args, version }: {
|
|
28
|
+
name: string;
|
|
29
|
+
args?: Record<string, any>;
|
|
30
|
+
version?: string;
|
|
31
|
+
}): Promise<GetPromptResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Set a notification handler for when the list of available prompts changes.
|
|
34
|
+
* @param handler The callback function to handle the notification.
|
|
35
|
+
*/
|
|
36
|
+
onListChanged(handler: () => void): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=promptActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptActions.d.ts","sourceRoot":"","sources":["../../src/client/promptActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,UAAU,yBAAyB;IACjC,MAAM,EAAE,uBAAuB,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;gBAE3B,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,yBAAyB;IAKzD;;;OAGG;IACU,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAyBtC;;;;;;OAMG;IACU,GAAG,CAAC,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAI/H;;;OAGG;IACU,aAAa,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/D"}
|