@llamaindex/llama-cloud-mcp 0.14.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/LICENSE +7 -0
- package/README.md +101 -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 +22 -0
- package/headers.js.map +1 -0
- package/headers.mjs +18 -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 +162 -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 +25 -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/types.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import LlamaCloud from '@llamaindex/llama-cloud';
|
|
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: LlamaCloud, 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,UAAU,MAAM,yBAAyB;OACzC,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;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AAE,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,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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