lark-billing-mcp 0.7.0
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/LICENSE +201 -0
- package/README.md +99 -0
- package/code-tool-types.d.mts +13 -0
- package/code-tool-types.d.mts.map +1 -0
- package/code-tool-types.d.ts +13 -0
- package/code-tool-types.d.ts.map +1 -0
- package/code-tool-types.js +4 -0
- package/code-tool-types.js.map +1 -0
- package/code-tool-types.mjs +3 -0
- package/code-tool-types.mjs.map +1 -0
- package/code-tool.d.mts +12 -0
- package/code-tool.d.mts.map +1 -0
- package/code-tool.d.ts +12 -0
- package/code-tool.d.ts.map +1 -0
- package/code-tool.js +85 -0
- package/code-tool.js.map +1 -0
- package/code-tool.mjs +82 -0
- package/code-tool.mjs.map +1 -0
- package/docs-search-tool.d.mts +50 -0
- package/docs-search-tool.d.mts.map +1 -0
- package/docs-search-tool.d.ts +50 -0
- package/docs-search-tool.d.ts.map +1 -0
- package/docs-search-tool.js +51 -0
- package/docs-search-tool.js.map +1 -0
- package/docs-search-tool.mjs +47 -0
- package/docs-search-tool.mjs.map +1 -0
- package/headers.d.mts +4 -0
- package/headers.d.mts.map +1 -0
- package/headers.d.ts +4 -0
- package/headers.d.ts.map +1 -0
- package/headers.js +10 -0
- package/headers.js.map +1 -0
- package/headers.mjs +6 -0
- package/headers.mjs.map +1 -0
- package/http.d.mts +9 -0
- package/http.d.mts.map +1 -0
- package/http.d.ts +9 -0
- package/http.d.ts.map +1 -0
- package/http.js +91 -0
- package/http.js.map +1 -0
- package/http.mjs +83 -0
- package/http.mjs.map +1 -0
- package/index.d.mts +3 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +55 -0
- package/index.js.map +1 -0
- package/index.mjs +53 -0
- package/index.mjs.map +1 -0
- package/options.d.mts +11 -0
- package/options.d.mts.map +1 -0
- package/options.d.ts +11 -0
- package/options.d.ts.map +1 -0
- package/options.js +72 -0
- package/options.js.map +1 -0
- package/options.mjs +65 -0
- package/options.mjs.map +1 -0
- package/package.json +161 -0
- package/server.d.mts +30 -0
- package/server.d.mts.map +1 -0
- package/server.d.ts +30 -0
- package/server.d.ts.map +1 -0
- package/server.js +121 -0
- package/server.js.map +1 -0
- package/server.mjs +109 -0
- package/server.mjs.map +1 -0
- package/src/code-tool-types.ts +15 -0
- package/src/code-tool.ts +96 -0
- package/src/docs-search-tool.ts +59 -0
- package/src/headers.ts +10 -0
- package/src/http.ts +109 -0
- package/src/index.ts +61 -0
- package/src/options.ts +92 -0
- package/src/server.ts +147 -0
- package/src/stdio.ts +12 -0
- package/src/tsconfig.json +11 -0
- package/src/types.ts +115 -0
- package/stdio.d.mts +2 -0
- package/stdio.d.mts.map +1 -0
- package/stdio.d.ts +2 -0
- package/stdio.d.ts.map +1 -0
- package/stdio.js +14 -0
- package/stdio.js.map +1 -0
- package/stdio.mjs +10 -0
- package/stdio.mjs.map +1 -0
- package/types.d.mts +52 -0
- package/types.d.mts.map +1 -0
- package/types.d.ts +52 -0
- package/types.d.ts.map +1 -0
- package/types.js +58 -0
- package/types.js.map +1 -0
- package/types.mjs +53 -0
- package/types.mjs.map +1 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import Lark from 'lark-billing';
|
|
4
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
|
|
6
|
+
type TextContentBlock = {
|
|
7
|
+
type: 'text';
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type ImageContentBlock = {
|
|
12
|
+
type: 'image';
|
|
13
|
+
data: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type AudioContentBlock = {
|
|
18
|
+
type: 'audio';
|
|
19
|
+
data: string;
|
|
20
|
+
mimeType: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type ResourceContentBlock = {
|
|
24
|
+
type: 'resource';
|
|
25
|
+
resource:
|
|
26
|
+
| {
|
|
27
|
+
uri: string;
|
|
28
|
+
mimeType: string;
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
uri: string;
|
|
33
|
+
mimeType: string;
|
|
34
|
+
blob: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type ContentBlock = TextContentBlock | ImageContentBlock | AudioContentBlock | ResourceContentBlock;
|
|
39
|
+
|
|
40
|
+
export type ToolCallResult = {
|
|
41
|
+
content: ContentBlock[];
|
|
42
|
+
isError?: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type HandlerFunction = (
|
|
46
|
+
client: Lark,
|
|
47
|
+
args: Record<string, unknown> | undefined,
|
|
48
|
+
) => Promise<ToolCallResult>;
|
|
49
|
+
|
|
50
|
+
export function asTextContentResult(result: unknown): ToolCallResult {
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: JSON.stringify(result, null, 2),
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function asBinaryContentResult(response: Response): Promise<ToolCallResult> {
|
|
62
|
+
const blob = await response.blob();
|
|
63
|
+
const mimeType = blob.type;
|
|
64
|
+
const data = Buffer.from(await blob.arrayBuffer()).toString('base64');
|
|
65
|
+
if (mimeType.startsWith('image/')) {
|
|
66
|
+
return {
|
|
67
|
+
content: [{ type: 'image', mimeType, data }],
|
|
68
|
+
};
|
|
69
|
+
} else if (mimeType.startsWith('audio/')) {
|
|
70
|
+
return {
|
|
71
|
+
content: [{ type: 'audio', mimeType, data }],
|
|
72
|
+
};
|
|
73
|
+
} else {
|
|
74
|
+
return {
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: 'resource',
|
|
78
|
+
resource: {
|
|
79
|
+
// We must give a URI, even though this isn't actually an MCP resource.
|
|
80
|
+
uri: 'resource://tool-response',
|
|
81
|
+
mimeType,
|
|
82
|
+
blob: data,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function asErrorResult(message: string): ToolCallResult {
|
|
91
|
+
return {
|
|
92
|
+
content: [
|
|
93
|
+
{
|
|
94
|
+
type: 'text',
|
|
95
|
+
text: message,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
isError: true,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type Metadata = {
|
|
103
|
+
resource: string;
|
|
104
|
+
operation: 'read' | 'write';
|
|
105
|
+
tags: string[];
|
|
106
|
+
httpMethod?: string;
|
|
107
|
+
httpPath?: string;
|
|
108
|
+
operationId?: string;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export type McpTool = {
|
|
112
|
+
metadata: Metadata;
|
|
113
|
+
tool: Tool;
|
|
114
|
+
handler: HandlerFunction;
|
|
115
|
+
};
|
package/stdio.d.mts
ADDED
package/stdio.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,qBAQ7B,CAAC"}
|
package/stdio.d.ts
ADDED
package/stdio.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,qBAQ7B,CAAC"}
|
package/stdio.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.launchStdioServer = void 0;
|
|
4
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
|
+
const server_1 = require("./server.js");
|
|
6
|
+
const launchStdioServer = async () => {
|
|
7
|
+
const server = (0, server_1.newMcpServer)();
|
|
8
|
+
(0, server_1.initMcpServer)({ server });
|
|
9
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
10
|
+
await server.connect(transport);
|
|
11
|
+
console.error('MCP Server running on stdio');
|
|
12
|
+
};
|
|
13
|
+
exports.launchStdioServer = launchStdioServer;
|
|
14
|
+
//# sourceMappingURL=stdio.js.map
|
package/stdio.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AACjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IAC1C,MAAM,MAAM,GAAG,IAAA,qBAAY,GAAE,CAAC;IAE9B,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE1B,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
|
package/stdio.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
|
+
import { initMcpServer, newMcpServer } from "./server.mjs";
|
|
3
|
+
export const launchStdioServer = async () => {
|
|
4
|
+
const server = newMcpServer();
|
|
5
|
+
initMcpServer({ server });
|
|
6
|
+
const transport = new StdioServerTransport();
|
|
7
|
+
await server.connect(transport);
|
|
8
|
+
console.error('MCP Server running on stdio');
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=stdio.mjs.map
|
package/stdio.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OACzE,EAAE,aAAa,EAAE,YAAY,EAAE;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IAC1C,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE1B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC"}
|
package/types.d.mts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Lark from 'lark-billing';
|
|
2
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
type TextContentBlock = {
|
|
4
|
+
type: 'text';
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
type ImageContentBlock = {
|
|
8
|
+
type: 'image';
|
|
9
|
+
data: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
};
|
|
12
|
+
type AudioContentBlock = {
|
|
13
|
+
type: 'audio';
|
|
14
|
+
data: string;
|
|
15
|
+
mimeType: string;
|
|
16
|
+
};
|
|
17
|
+
type ResourceContentBlock = {
|
|
18
|
+
type: 'resource';
|
|
19
|
+
resource: {
|
|
20
|
+
uri: string;
|
|
21
|
+
mimeType: string;
|
|
22
|
+
text: string;
|
|
23
|
+
} | {
|
|
24
|
+
uri: string;
|
|
25
|
+
mimeType: string;
|
|
26
|
+
blob: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type ContentBlock = TextContentBlock | ImageContentBlock | AudioContentBlock | ResourceContentBlock;
|
|
30
|
+
export type ToolCallResult = {
|
|
31
|
+
content: ContentBlock[];
|
|
32
|
+
isError?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type HandlerFunction = (client: Lark, args: Record<string, unknown> | undefined) => Promise<ToolCallResult>;
|
|
35
|
+
export declare function asTextContentResult(result: unknown): ToolCallResult;
|
|
36
|
+
export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
|
|
37
|
+
export declare function asErrorResult(message: string): ToolCallResult;
|
|
38
|
+
export type Metadata = {
|
|
39
|
+
resource: string;
|
|
40
|
+
operation: 'read' | 'write';
|
|
41
|
+
tags: string[];
|
|
42
|
+
httpMethod?: string;
|
|
43
|
+
httpPath?: string;
|
|
44
|
+
operationId?: string;
|
|
45
|
+
};
|
|
46
|
+
export type McpTool = {
|
|
47
|
+
metadata: Metadata;
|
|
48
|
+
tool: Tool;
|
|
49
|
+
handler: HandlerFunction;
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=types.d.mts.map
|
package/types.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO,IAAI,MAAM,cAAc;OACxB,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,UAAU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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Lark from 'lark-billing';
|
|
2
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
type TextContentBlock = {
|
|
4
|
+
type: 'text';
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
type ImageContentBlock = {
|
|
8
|
+
type: 'image';
|
|
9
|
+
data: string;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
};
|
|
12
|
+
type AudioContentBlock = {
|
|
13
|
+
type: 'audio';
|
|
14
|
+
data: string;
|
|
15
|
+
mimeType: string;
|
|
16
|
+
};
|
|
17
|
+
type ResourceContentBlock = {
|
|
18
|
+
type: 'resource';
|
|
19
|
+
resource: {
|
|
20
|
+
uri: string;
|
|
21
|
+
mimeType: string;
|
|
22
|
+
text: string;
|
|
23
|
+
} | {
|
|
24
|
+
uri: string;
|
|
25
|
+
mimeType: string;
|
|
26
|
+
blob: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type ContentBlock = TextContentBlock | ImageContentBlock | AudioContentBlock | ResourceContentBlock;
|
|
30
|
+
export type ToolCallResult = {
|
|
31
|
+
content: ContentBlock[];
|
|
32
|
+
isError?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type HandlerFunction = (client: Lark, args: Record<string, unknown> | undefined) => Promise<ToolCallResult>;
|
|
35
|
+
export declare function asTextContentResult(result: unknown): ToolCallResult;
|
|
36
|
+
export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
|
|
37
|
+
export declare function asErrorResult(message: string): ToolCallResult;
|
|
38
|
+
export type Metadata = {
|
|
39
|
+
resource: string;
|
|
40
|
+
operation: 'read' | 'write';
|
|
41
|
+
tags: string[];
|
|
42
|
+
httpMethod?: string;
|
|
43
|
+
httpPath?: string;
|
|
44
|
+
operationId?: string;
|
|
45
|
+
};
|
|
46
|
+
export type McpTool = {
|
|
47
|
+
metadata: Metadata;
|
|
48
|
+
tool: Tool;
|
|
49
|
+
handler: HandlerFunction;
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=types.d.ts.map
|
package/types.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO,IAAI,MAAM,cAAc;OACxB,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EACJ;QACE,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,GACD;QACE,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACP,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAE3G,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAC5B,MAAM,EAAE,IAAI,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KACtC,OAAO,CAAC,cAAc,CAAC,CAAC;AAE7B,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CASnE;AAED,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CA2BvF;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAU7D;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC"}
|
package/types.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.asTextContentResult = asTextContentResult;
|
|
5
|
+
exports.asBinaryContentResult = asBinaryContentResult;
|
|
6
|
+
exports.asErrorResult = asErrorResult;
|
|
7
|
+
function asTextContentResult(result) {
|
|
8
|
+
return {
|
|
9
|
+
content: [
|
|
10
|
+
{
|
|
11
|
+
type: 'text',
|
|
12
|
+
text: JSON.stringify(result, null, 2),
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
async function asBinaryContentResult(response) {
|
|
18
|
+
const blob = await response.blob();
|
|
19
|
+
const mimeType = blob.type;
|
|
20
|
+
const data = Buffer.from(await blob.arrayBuffer()).toString('base64');
|
|
21
|
+
if (mimeType.startsWith('image/')) {
|
|
22
|
+
return {
|
|
23
|
+
content: [{ type: 'image', mimeType, data }],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
else if (mimeType.startsWith('audio/')) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: 'audio', mimeType, data }],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'resource',
|
|
36
|
+
resource: {
|
|
37
|
+
// We must give a URI, even though this isn't actually an MCP resource.
|
|
38
|
+
uri: 'resource://tool-response',
|
|
39
|
+
mimeType,
|
|
40
|
+
blob: data,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function asErrorResult(message) {
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: 'text',
|
|
52
|
+
text: message,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
isError: true,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=types.js.map
|
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAiDtF,kDASC;AAED,sDA2BC;AAED,sCAUC;AAlDD,SAAgB,mBAAmB,CAAC,MAAe;IACjD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aACtC;SACF;KACF,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,qBAAqB,CAAC,QAAkB;IAC5D,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtE,IAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClC,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7C,CAAC;IACJ,CAAC;SAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7C,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,UAAU;oBAChB,QAAQ,EAAE;wBACR,uEAAuE;wBACvE,GAAG,EAAE,0BAA0B;wBAC/B,QAAQ;wBACR,IAAI,EAAE,IAAI;qBACX;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAAC,OAAe;IAC3C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO;aACd;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
package/types.mjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export function asTextContentResult(result) {
|
|
3
|
+
return {
|
|
4
|
+
content: [
|
|
5
|
+
{
|
|
6
|
+
type: 'text',
|
|
7
|
+
text: JSON.stringify(result, null, 2),
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export async function asBinaryContentResult(response) {
|
|
13
|
+
const blob = await response.blob();
|
|
14
|
+
const mimeType = blob.type;
|
|
15
|
+
const data = Buffer.from(await blob.arrayBuffer()).toString('base64');
|
|
16
|
+
if (mimeType.startsWith('image/')) {
|
|
17
|
+
return {
|
|
18
|
+
content: [{ type: 'image', mimeType, data }],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
else if (mimeType.startsWith('audio/')) {
|
|
22
|
+
return {
|
|
23
|
+
content: [{ type: 'audio', mimeType, data }],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return {
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: 'resource',
|
|
31
|
+
resource: {
|
|
32
|
+
// We must give a URI, even though this isn't actually an MCP resource.
|
|
33
|
+
uri: 'resource://tool-response',
|
|
34
|
+
mimeType,
|
|
35
|
+
blob: data,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function asErrorResult(message) {
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: 'text',
|
|
47
|
+
text: message,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
isError: true,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=types.mjs.map
|
package/types.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAiDtF,MAAM,UAAU,mBAAmB,CAAC,MAAe;IACjD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aACtC;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAq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