@henrylabs/mcp 0.14.0 → 0.15.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/code-tool-types.d.mts +2 -0
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts +2 -0
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool.d.mts +44 -2
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +44 -2
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +22 -129
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +22 -96
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +12 -6
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +12 -6
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +3 -0
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +3 -0
- package/docs-search-tool.mjs.map +1 -1
- package/package.json +3 -19
- package/server.js +1 -1
- package/server.mjs +1 -1
- package/src/code-tool-types.ts +5 -1
- package/src/code-tool.ts +32 -121
- package/src/docs-search-tool.ts +7 -0
- package/src/server.ts +1 -1
- package/src/tools/cart/create-cart-checkout.ts +5 -1
- package/src/tools/cart/items/add-cart-items.ts +1 -1
- package/src/tools/cart/items/clear-cart-items.ts +1 -1
- package/src/tools/cart/items/list-cart-items.ts +1 -1
- package/src/tools/cart/items/remove-cart-items.ts +1 -1
- package/src/tools/orders/retrieve-status-orders.ts +1 -1
- package/src/tools/products/retrieve-product-details.ts +9 -2
- package/src/tools/products/search-products.ts +1 -1
- package/src/tools/wallet/collect-payment-details.ts +1 -1
- package/tools/cart/create-cart-checkout.d.mts +12 -6
- package/tools/cart/create-cart-checkout.d.mts.map +1 -1
- package/tools/cart/create-cart-checkout.d.ts +12 -6
- package/tools/cart/create-cart-checkout.d.ts.map +1 -1
- package/tools/cart/create-cart-checkout.js +9 -1
- package/tools/cart/create-cart-checkout.js.map +1 -1
- package/tools/cart/create-cart-checkout.mjs +6 -1
- package/tools/cart/create-cart-checkout.mjs.map +1 -1
- package/tools/cart/items/add-cart-items.d.mts +12 -6
- package/tools/cart/items/add-cart-items.d.mts.map +1 -1
- package/tools/cart/items/add-cart-items.d.ts +12 -6
- package/tools/cart/items/add-cart-items.d.ts.map +1 -1
- package/tools/cart/items/add-cart-items.js +5 -1
- package/tools/cart/items/add-cart-items.js.map +1 -1
- package/tools/cart/items/add-cart-items.mjs +2 -1
- package/tools/cart/items/add-cart-items.mjs.map +1 -1
- package/tools/cart/items/clear-cart-items.d.mts +12 -6
- package/tools/cart/items/clear-cart-items.d.mts.map +1 -1
- package/tools/cart/items/clear-cart-items.d.ts +12 -6
- package/tools/cart/items/clear-cart-items.d.ts.map +1 -1
- package/tools/cart/items/clear-cart-items.js +5 -1
- package/tools/cart/items/clear-cart-items.js.map +1 -1
- package/tools/cart/items/clear-cart-items.mjs +2 -1
- package/tools/cart/items/clear-cart-items.mjs.map +1 -1
- package/tools/cart/items/list-cart-items.d.mts +12 -6
- package/tools/cart/items/list-cart-items.d.mts.map +1 -1
- package/tools/cart/items/list-cart-items.d.ts +12 -6
- package/tools/cart/items/list-cart-items.d.ts.map +1 -1
- package/tools/cart/items/list-cart-items.js +5 -1
- package/tools/cart/items/list-cart-items.js.map +1 -1
- package/tools/cart/items/list-cart-items.mjs +2 -1
- package/tools/cart/items/list-cart-items.mjs.map +1 -1
- package/tools/cart/items/remove-cart-items.d.mts +12 -6
- package/tools/cart/items/remove-cart-items.d.mts.map +1 -1
- package/tools/cart/items/remove-cart-items.d.ts +12 -6
- package/tools/cart/items/remove-cart-items.d.ts.map +1 -1
- package/tools/cart/items/remove-cart-items.js +5 -1
- package/tools/cart/items/remove-cart-items.js.map +1 -1
- package/tools/cart/items/remove-cart-items.mjs +2 -1
- package/tools/cart/items/remove-cart-items.mjs.map +1 -1
- package/tools/orders/retrieve-status-orders.d.mts +12 -6
- package/tools/orders/retrieve-status-orders.d.mts.map +1 -1
- package/tools/orders/retrieve-status-orders.d.ts +12 -6
- package/tools/orders/retrieve-status-orders.d.ts.map +1 -1
- package/tools/orders/retrieve-status-orders.js +5 -1
- package/tools/orders/retrieve-status-orders.js.map +1 -1
- package/tools/orders/retrieve-status-orders.mjs +2 -1
- package/tools/orders/retrieve-status-orders.mjs.map +1 -1
- package/tools/products/retrieve-product-details.d.mts +12 -6
- package/tools/products/retrieve-product-details.d.mts.map +1 -1
- package/tools/products/retrieve-product-details.d.ts +12 -6
- package/tools/products/retrieve-product-details.d.ts.map +1 -1
- package/tools/products/retrieve-product-details.js +13 -1
- package/tools/products/retrieve-product-details.js.map +1 -1
- package/tools/products/retrieve-product-details.mjs +11 -2
- package/tools/products/retrieve-product-details.mjs.map +1 -1
- package/tools/products/search-products.d.mts +12 -6
- package/tools/products/search-products.d.mts.map +1 -1
- package/tools/products/search-products.d.ts +12 -6
- package/tools/products/search-products.d.ts.map +1 -1
- package/tools/products/search-products.js +5 -1
- package/tools/products/search-products.js.map +1 -1
- package/tools/products/search-products.mjs +2 -1
- package/tools/products/search-products.mjs.map +1 -1
- package/tools/wallet/collect-payment-details.d.mts +12 -6
- package/tools/wallet/collect-payment-details.d.mts.map +1 -1
- package/tools/wallet/collect-payment-details.d.ts +12 -6
- package/tools/wallet/collect-payment-details.d.ts.map +1 -1
- package/tools/wallet/collect-payment-details.js +5 -1
- package/tools/wallet/collect-payment-details.js.map +1 -1
- package/tools/wallet/collect-payment-details.mjs +2 -1
- package/tools/wallet/collect-payment-details.mjs.map +1 -1
- package/code-tool-paths.cjs +0 -6
- package/code-tool-paths.cjs.map +0 -1
- package/code-tool-paths.d.cts +0 -2
- package/code-tool-paths.d.cts.map +0 -1
- package/code-tool-worker.d.mts +0 -5
- package/code-tool-worker.d.mts.map +0 -1
- package/code-tool-worker.d.ts +0 -5
- package/code-tool-worker.d.ts.map +0 -1
- package/code-tool-worker.js +0 -162
- package/code-tool-worker.js.map +0 -1
- package/code-tool-worker.mjs +0 -157
- package/code-tool-worker.mjs.map +0 -1
- package/src/code-tool-paths.cts +0 -3
- package/src/code-tool-worker.ts +0 -208
package/code-tool-types.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,gBAAgB;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;
|
|
1
|
+
{"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,gBAAgB;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC"}
|
package/code-tool-types.d.ts
CHANGED
package/code-tool-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,gBAAgB;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;
|
|
1
|
+
{"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,gBAAgB;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC"}
|
package/code-tool.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Metadata, ToolCallResult } from "./tools/types.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* A tool that runs code against a copy of the SDK.
|
|
4
4
|
*
|
|
@@ -8,5 +8,47 @@ import { Endpoint } from "./tools/types.mjs";
|
|
|
8
8
|
*
|
|
9
9
|
* @param endpoints - The endpoints to include in the list.
|
|
10
10
|
*/
|
|
11
|
-
export declare function codeTool(): Promise<
|
|
11
|
+
export declare function codeTool(): Promise<{
|
|
12
|
+
metadata: Metadata;
|
|
13
|
+
tool: {
|
|
14
|
+
inputSchema: {
|
|
15
|
+
[x: string]: unknown;
|
|
16
|
+
type: "object";
|
|
17
|
+
properties?: {
|
|
18
|
+
[x: string]: object;
|
|
19
|
+
} | undefined;
|
|
20
|
+
required?: string[] | undefined;
|
|
21
|
+
};
|
|
22
|
+
name: string;
|
|
23
|
+
description?: string | undefined;
|
|
24
|
+
outputSchema?: {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
type: "object";
|
|
27
|
+
properties?: {
|
|
28
|
+
[x: string]: object;
|
|
29
|
+
} | undefined;
|
|
30
|
+
required?: string[] | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
annotations?: {
|
|
33
|
+
title?: string | undefined;
|
|
34
|
+
readOnlyHint?: boolean | undefined;
|
|
35
|
+
destructiveHint?: boolean | undefined;
|
|
36
|
+
idempotentHint?: boolean | undefined;
|
|
37
|
+
openWorldHint?: boolean | undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
execution?: {
|
|
40
|
+
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
_meta?: {
|
|
43
|
+
[x: string]: unknown;
|
|
44
|
+
} | undefined;
|
|
45
|
+
icons?: {
|
|
46
|
+
src: string;
|
|
47
|
+
mimeType?: string | undefined;
|
|
48
|
+
sizes?: string[] | undefined;
|
|
49
|
+
}[] | undefined;
|
|
50
|
+
title?: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
handler: (_: unknown, args: any) => Promise<ToolCallResult>;
|
|
53
|
+
}>;
|
|
12
54
|
//# sourceMappingURL=code-tool.d.mts.map
|
package/code-tool.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAE,cAAc,EAAuB;AAIxD;;;;;;;;GAQG;AACH,wBAAsB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQF,OAAO,QAAQ,GAAG,KAAG,OAAO,CAAC,cAAc,CAAC;GAkCvE"}
|
package/code-tool.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Metadata, ToolCallResult } from "./tools/types.js";
|
|
2
2
|
/**
|
|
3
3
|
* A tool that runs code against a copy of the SDK.
|
|
4
4
|
*
|
|
@@ -8,5 +8,47 @@ import { Endpoint } from "./tools/types.js";
|
|
|
8
8
|
*
|
|
9
9
|
* @param endpoints - The endpoints to include in the list.
|
|
10
10
|
*/
|
|
11
|
-
export declare function codeTool(): Promise<
|
|
11
|
+
export declare function codeTool(): Promise<{
|
|
12
|
+
metadata: Metadata;
|
|
13
|
+
tool: {
|
|
14
|
+
inputSchema: {
|
|
15
|
+
[x: string]: unknown;
|
|
16
|
+
type: "object";
|
|
17
|
+
properties?: {
|
|
18
|
+
[x: string]: object;
|
|
19
|
+
} | undefined;
|
|
20
|
+
required?: string[] | undefined;
|
|
21
|
+
};
|
|
22
|
+
name: string;
|
|
23
|
+
description?: string | undefined;
|
|
24
|
+
outputSchema?: {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
type: "object";
|
|
27
|
+
properties?: {
|
|
28
|
+
[x: string]: object;
|
|
29
|
+
} | undefined;
|
|
30
|
+
required?: string[] | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
annotations?: {
|
|
33
|
+
title?: string | undefined;
|
|
34
|
+
readOnlyHint?: boolean | undefined;
|
|
35
|
+
destructiveHint?: boolean | undefined;
|
|
36
|
+
idempotentHint?: boolean | undefined;
|
|
37
|
+
openWorldHint?: boolean | undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
execution?: {
|
|
40
|
+
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
_meta?: {
|
|
43
|
+
[x: string]: unknown;
|
|
44
|
+
} | undefined;
|
|
45
|
+
icons?: {
|
|
46
|
+
src: string;
|
|
47
|
+
mimeType?: string | undefined;
|
|
48
|
+
sizes?: string[] | undefined;
|
|
49
|
+
}[] | undefined;
|
|
50
|
+
title?: string | undefined;
|
|
51
|
+
};
|
|
52
|
+
handler: (_: unknown, args: any) => Promise<ToolCallResult>;
|
|
53
|
+
}>;
|
|
12
54
|
//# sourceMappingURL=code-tool.d.ts.map
|
package/code-tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAE,cAAc,EAAuB;AAIxD;;;;;;;;GAQG;AACH,wBAAsB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQF,OAAO,QAAQ,GAAG,KAAG,OAAO,CAAC,cAAc,CAAC;GAkCvE"}
|
package/code-tool.js
CHANGED
|
@@ -1,42 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
4
|
exports.codeTool = codeTool;
|
|
38
|
-
const
|
|
39
|
-
const
|
|
5
|
+
const types_1 = require("./tools/types.js");
|
|
6
|
+
const server_1 = require("./server.js");
|
|
40
7
|
/**
|
|
41
8
|
* A tool that runs code against a copy of the SDK.
|
|
42
9
|
*
|
|
@@ -50,105 +17,31 @@ async function codeTool() {
|
|
|
50
17
|
const metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
51
18
|
const tool = {
|
|
52
19
|
name: 'execute',
|
|
53
|
-
description: 'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized
|
|
20
|
+
description: 'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.\nWrite code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```\n\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
|
|
54
21
|
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
|
|
55
22
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// even though they are not set.
|
|
69
|
-
'--allow-env',
|
|
70
|
-
],
|
|
71
|
-
printOutput: true,
|
|
72
|
-
spawnOptions: {
|
|
73
|
-
cwd: (0, node_path_1.dirname)(workerPath),
|
|
23
|
+
const handler = async (_, args) => {
|
|
24
|
+
const code = args.code;
|
|
25
|
+
// this is not required, but passing a Stainless API key for the matching project_name
|
|
26
|
+
// will allow you to run code-mode queries against non-published versions of your SDK.
|
|
27
|
+
const stainlessAPIKey = (0, server_1.readEnv)('STAINLESS_API_KEY');
|
|
28
|
+
const codeModeEndpoint = (0, server_1.readEnv)('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
|
|
29
|
+
const res = await fetch(codeModeEndpoint, {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: {
|
|
32
|
+
...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
client_envs: JSON.stringify({ HENRY_SDK_API_KEY: (0, server_1.readEnv)('HENRY_SDK_API_KEY') }),
|
|
74
35
|
},
|
|
36
|
+
body: JSON.stringify({
|
|
37
|
+
project_name: 'henry-sdk',
|
|
38
|
+
code,
|
|
39
|
+
}),
|
|
75
40
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
worker.addEventListener('exit', (exitCode) => {
|
|
79
|
-
reject(new Error(`Worker exited with code ${exitCode}`));
|
|
80
|
-
});
|
|
81
|
-
const opts = {
|
|
82
|
-
baseURL: client.baseURL,
|
|
83
|
-
apiKey: client.apiKey,
|
|
84
|
-
defaultHeaders: {
|
|
85
|
-
'X-Stainless-MCP': 'true',
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
const req = worker.request('http://localhost', {
|
|
89
|
-
headers: {
|
|
90
|
-
'content-type': 'application/json',
|
|
91
|
-
},
|
|
92
|
-
method: 'POST',
|
|
93
|
-
}, (resp) => {
|
|
94
|
-
const body = [];
|
|
95
|
-
resp.on('error', (err) => {
|
|
96
|
-
reject(err);
|
|
97
|
-
});
|
|
98
|
-
resp.on('data', (chunk) => {
|
|
99
|
-
body.push(chunk);
|
|
100
|
-
});
|
|
101
|
-
resp.on('end', () => {
|
|
102
|
-
resolve(new Response(Buffer.concat(body).toString(), {
|
|
103
|
-
status: resp.statusCode ?? 200,
|
|
104
|
-
headers: resp.headers,
|
|
105
|
-
}));
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
const body = JSON.stringify({
|
|
109
|
-
opts,
|
|
110
|
-
code,
|
|
111
|
-
});
|
|
112
|
-
req.write(body, (err) => {
|
|
113
|
-
if (err != null) {
|
|
114
|
-
reject(err);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
req.end();
|
|
118
|
-
});
|
|
119
|
-
if (resp.status === 200) {
|
|
120
|
-
const { result, logLines, errLines } = (await resp.json());
|
|
121
|
-
const returnOutput = result == null ? null : ({
|
|
122
|
-
type: 'text',
|
|
123
|
-
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
124
|
-
});
|
|
125
|
-
const logOutput = logLines.length === 0 ?
|
|
126
|
-
null
|
|
127
|
-
: {
|
|
128
|
-
type: 'text',
|
|
129
|
-
text: logLines.join('\n'),
|
|
130
|
-
};
|
|
131
|
-
const errOutput = errLines.length === 0 ?
|
|
132
|
-
null
|
|
133
|
-
: {
|
|
134
|
-
type: 'text',
|
|
135
|
-
text: 'Error output:\n' + errLines.join('\n'),
|
|
136
|
-
};
|
|
137
|
-
return {
|
|
138
|
-
content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
const { message } = (await resp.json());
|
|
143
|
-
return {
|
|
144
|
-
content: message == null ? [] : [{ type: 'text', text: message }],
|
|
145
|
-
isError: true,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
finally {
|
|
150
|
-
worker.terminate();
|
|
41
|
+
if (!res.ok) {
|
|
42
|
+
throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
|
|
151
43
|
}
|
|
44
|
+
return (0, types_1.asTextContentResult)((await res.json()));
|
|
152
45
|
};
|
|
153
46
|
return { metadata, tool, handler };
|
|
154
47
|
}
|
package/code-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAetF,4BA0CC;AAvDD,4CAA8E;AAE9E,wCAAmC;AAEnC;;;;;;;;GAQG;AACI,KAAK,UAAU,QAAQ;IAC5B,MAAM,QAAQ,GAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC7E,MAAM,IAAI,GAAS;QACjB,IAAI,EAAE,SAAS;QACf,WAAW,EACT,iiCAAiiC;QACniC,WAAW,EAAE,EAAE,IAAI,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
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { asTextContentResult } from "./tools/types.mjs";
|
|
3
|
+
import { readEnv } from "./server.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* A tool that runs code against a copy of the SDK.
|
|
6
6
|
*
|
|
@@ -14,105 +14,31 @@ export async function codeTool() {
|
|
|
14
14
|
const metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
15
15
|
const tool = {
|
|
16
16
|
name: 'execute',
|
|
17
|
-
description: 'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized
|
|
17
|
+
description: 'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.\nWrite code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```\n\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
|
|
18
18
|
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// even though they are not set.
|
|
33
|
-
'--allow-env',
|
|
34
|
-
],
|
|
35
|
-
printOutput: true,
|
|
36
|
-
spawnOptions: {
|
|
37
|
-
cwd: dirname(workerPath),
|
|
20
|
+
const handler = async (_, args) => {
|
|
21
|
+
const code = args.code;
|
|
22
|
+
// this is not required, but passing a Stainless API key for the matching project_name
|
|
23
|
+
// will allow you to run code-mode queries against non-published versions of your SDK.
|
|
24
|
+
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
|
25
|
+
const codeModeEndpoint = readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
|
|
26
|
+
const res = await fetch(codeModeEndpoint, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
headers: {
|
|
29
|
+
...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
client_envs: JSON.stringify({ HENRY_SDK_API_KEY: readEnv('HENRY_SDK_API_KEY') }),
|
|
38
32
|
},
|
|
33
|
+
body: JSON.stringify({
|
|
34
|
+
project_name: 'henry-sdk',
|
|
35
|
+
code,
|
|
36
|
+
}),
|
|
39
37
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
worker.addEventListener('exit', (exitCode) => {
|
|
43
|
-
reject(new Error(`Worker exited with code ${exitCode}`));
|
|
44
|
-
});
|
|
45
|
-
const opts = {
|
|
46
|
-
baseURL: client.baseURL,
|
|
47
|
-
apiKey: client.apiKey,
|
|
48
|
-
defaultHeaders: {
|
|
49
|
-
'X-Stainless-MCP': 'true',
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
const req = worker.request('http://localhost', {
|
|
53
|
-
headers: {
|
|
54
|
-
'content-type': 'application/json',
|
|
55
|
-
},
|
|
56
|
-
method: 'POST',
|
|
57
|
-
}, (resp) => {
|
|
58
|
-
const body = [];
|
|
59
|
-
resp.on('error', (err) => {
|
|
60
|
-
reject(err);
|
|
61
|
-
});
|
|
62
|
-
resp.on('data', (chunk) => {
|
|
63
|
-
body.push(chunk);
|
|
64
|
-
});
|
|
65
|
-
resp.on('end', () => {
|
|
66
|
-
resolve(new Response(Buffer.concat(body).toString(), {
|
|
67
|
-
status: resp.statusCode ?? 200,
|
|
68
|
-
headers: resp.headers,
|
|
69
|
-
}));
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
const body = JSON.stringify({
|
|
73
|
-
opts,
|
|
74
|
-
code,
|
|
75
|
-
});
|
|
76
|
-
req.write(body, (err) => {
|
|
77
|
-
if (err != null) {
|
|
78
|
-
reject(err);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
req.end();
|
|
82
|
-
});
|
|
83
|
-
if (resp.status === 200) {
|
|
84
|
-
const { result, logLines, errLines } = (await resp.json());
|
|
85
|
-
const returnOutput = result == null ? null : ({
|
|
86
|
-
type: 'text',
|
|
87
|
-
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
88
|
-
});
|
|
89
|
-
const logOutput = logLines.length === 0 ?
|
|
90
|
-
null
|
|
91
|
-
: {
|
|
92
|
-
type: 'text',
|
|
93
|
-
text: logLines.join('\n'),
|
|
94
|
-
};
|
|
95
|
-
const errOutput = errLines.length === 0 ?
|
|
96
|
-
null
|
|
97
|
-
: {
|
|
98
|
-
type: 'text',
|
|
99
|
-
text: 'Error output:\n' + errLines.join('\n'),
|
|
100
|
-
};
|
|
101
|
-
return {
|
|
102
|
-
content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
const { message } = (await resp.json());
|
|
107
|
-
return {
|
|
108
|
-
content: message == null ? [] : [{ type: 'text', text: message }],
|
|
109
|
-
isError: true,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
finally {
|
|
114
|
-
worker.terminate();
|
|
38
|
+
if (!res.ok) {
|
|
39
|
+
throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
|
|
115
40
|
}
|
|
41
|
+
return asTextContentResult((await res.json()));
|
|
116
42
|
};
|
|
117
43
|
return { metadata, tool, handler };
|
|
118
44
|
}
|
package/code-tool.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.mjs","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,
|
|
1
|
+
{"version":3,"file":"code-tool.mjs","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAA4B,mBAAmB,EAAE;OAEjD,EAAE,OAAO,EAAE;AAElB;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,MAAM,QAAQ,GAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC7E,MAAM,IAAI,GAAS;QACjB,IAAI,EAAE,SAAS;QACf,WAAW,EACT,iiCAAiiC;QACniC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;KAC1E,CAAC;IACF,MAAM,OAAO,GAAG,KAAK,EAAE,CAAU,EAAE,IAAS,EAA2B,EAAE;QACvE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAc,CAAC;QAEjC,sFAAsF;QACtF,sFAAsF;QACtF,MAAM,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACrD,MAAM,gBAAgB,GACpB,OAAO,CAAC,wBAAwB,CAAC,IAAI,4CAA4C,CAAC;QAEpF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,gBAAgB,EAAE;YACxC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,GAAG,CAAC,eAAe,IAAI,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC;gBAC1D,cAAc,EAAE,kBAAkB;gBAClC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC;aACjF;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,YAAY,EAAE,WAAW;gBACzB,IAAI;aACL,CAAC;SACH,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,GAAG,GAAG,CAAC,MAAM,KACX,GAAG,CAAC,UACN,4DAA4D,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CAC/E,CAAC;QACJ,CAAC;QAED,OAAO,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAkB,CAAC,CAAC;IAClE,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
|
package/docs-search-tool.d.mts
CHANGED
|
@@ -6,37 +6,43 @@ export declare const handler: (_: unknown, args: Record<string, unknown> | undef
|
|
|
6
6
|
declare const _default: {
|
|
7
7
|
metadata: Metadata;
|
|
8
8
|
tool: {
|
|
9
|
-
[x: string]: unknown;
|
|
10
|
-
name: string;
|
|
11
9
|
inputSchema: {
|
|
12
10
|
[x: string]: unknown;
|
|
13
11
|
type: "object";
|
|
14
12
|
properties?: {
|
|
15
|
-
[x: string]:
|
|
13
|
+
[x: string]: object;
|
|
16
14
|
} | undefined;
|
|
17
15
|
required?: string[] | undefined;
|
|
18
16
|
};
|
|
19
|
-
|
|
17
|
+
name: string;
|
|
20
18
|
description?: string | undefined;
|
|
21
19
|
outputSchema?: {
|
|
22
20
|
[x: string]: unknown;
|
|
23
21
|
type: "object";
|
|
24
22
|
properties?: {
|
|
25
|
-
[x: string]:
|
|
23
|
+
[x: string]: object;
|
|
26
24
|
} | undefined;
|
|
27
25
|
required?: string[] | undefined;
|
|
28
26
|
} | undefined;
|
|
29
27
|
annotations?: {
|
|
30
|
-
[x: string]: unknown;
|
|
31
28
|
title?: string | undefined;
|
|
32
29
|
readOnlyHint?: boolean | undefined;
|
|
33
30
|
destructiveHint?: boolean | undefined;
|
|
34
31
|
idempotentHint?: boolean | undefined;
|
|
35
32
|
openWorldHint?: boolean | undefined;
|
|
36
33
|
} | undefined;
|
|
34
|
+
execution?: {
|
|
35
|
+
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
36
|
+
} | undefined;
|
|
37
37
|
_meta?: {
|
|
38
38
|
[x: string]: unknown;
|
|
39
39
|
} | undefined;
|
|
40
|
+
icons?: {
|
|
41
|
+
src: string;
|
|
42
|
+
mimeType?: string | undefined;
|
|
43
|
+
sizes?: string[] | undefined;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
title?: string | undefined;
|
|
40
46
|
};
|
|
41
47
|
handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./tools/types").ToolCallResult>;
|
|
42
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-search-tool.d.mts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IA0BlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"docs-search-tool.d.mts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IA0BlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,oDAYlF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAZ+B,OAAO,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAcnF,wBAA2C"}
|
package/docs-search-tool.d.ts
CHANGED
|
@@ -6,37 +6,43 @@ export declare const handler: (_: unknown, args: Record<string, unknown> | undef
|
|
|
6
6
|
declare const _default: {
|
|
7
7
|
metadata: Metadata;
|
|
8
8
|
tool: {
|
|
9
|
-
[x: string]: unknown;
|
|
10
|
-
name: string;
|
|
11
9
|
inputSchema: {
|
|
12
10
|
[x: string]: unknown;
|
|
13
11
|
type: "object";
|
|
14
12
|
properties?: {
|
|
15
|
-
[x: string]:
|
|
13
|
+
[x: string]: object;
|
|
16
14
|
} | undefined;
|
|
17
15
|
required?: string[] | undefined;
|
|
18
16
|
};
|
|
19
|
-
|
|
17
|
+
name: string;
|
|
20
18
|
description?: string | undefined;
|
|
21
19
|
outputSchema?: {
|
|
22
20
|
[x: string]: unknown;
|
|
23
21
|
type: "object";
|
|
24
22
|
properties?: {
|
|
25
|
-
[x: string]:
|
|
23
|
+
[x: string]: object;
|
|
26
24
|
} | undefined;
|
|
27
25
|
required?: string[] | undefined;
|
|
28
26
|
} | undefined;
|
|
29
27
|
annotations?: {
|
|
30
|
-
[x: string]: unknown;
|
|
31
28
|
title?: string | undefined;
|
|
32
29
|
readOnlyHint?: boolean | undefined;
|
|
33
30
|
destructiveHint?: boolean | undefined;
|
|
34
31
|
idempotentHint?: boolean | undefined;
|
|
35
32
|
openWorldHint?: boolean | undefined;
|
|
36
33
|
} | undefined;
|
|
34
|
+
execution?: {
|
|
35
|
+
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
36
|
+
} | undefined;
|
|
37
37
|
_meta?: {
|
|
38
38
|
[x: string]: unknown;
|
|
39
39
|
} | undefined;
|
|
40
|
+
icons?: {
|
|
41
|
+
src: string;
|
|
42
|
+
mimeType?: string | undefined;
|
|
43
|
+
sizes?: string[] | undefined;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
title?: string | undefined;
|
|
40
46
|
};
|
|
41
47
|
handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./tools/types").ToolCallResult>;
|
|
42
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-search-tool.d.ts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IA0BlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"docs-search-tool.d.ts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IA0BlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,oDAYlF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAZ+B,OAAO,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAcnF,wBAA2C"}
|
package/docs-search-tool.js
CHANGED
|
@@ -41,6 +41,9 @@ const handler = async (_, args) => {
|
|
|
41
41
|
const body = args;
|
|
42
42
|
const query = new URLSearchParams(body).toString();
|
|
43
43
|
const result = await fetch(`${docsSearchURL}?${query}`);
|
|
44
|
+
if (!result.ok) {
|
|
45
|
+
throw new Error(`${result.status}: ${result.statusText} when using doc search tool. Details: ${await result.text()}`);
|
|
46
|
+
}
|
|
44
47
|
return (0, types_1.asTextContentResult)(await result.json());
|
|
45
48
|
};
|
|
46
49
|
exports.handler = handler;
|
package/docs-search-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-search-tool.js","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4CAA8D;AAIjD,QAAA,QAAQ,GAAa;IAChC,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,KAAK;CAClB,CAAC;AAEW,QAAA,IAAI,GAAS;IACxB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,8EAA8E;IAC3F,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0BAA0B;aACxC;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;gBACtD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;aAClG;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;gBAC9C,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;aAC7B;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;KAChC;IACD,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,MAAM,aAAa,GACjB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,8DAA8D,CAAC;AAE5F,MAAM,OAAO,GAAG,KAAK,EAAE,CAAU,EAAE,IAAyC,EAAE,EAAE;IACrF,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MA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