@cjavdev/believe-mcp 0.8.0 → 0.11.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/auth.d.mts +3 -1
- package/auth.d.mts.map +1 -1
- package/auth.d.ts +3 -1
- package/auth.d.ts.map +1 -1
- package/auth.js +15 -3
- package/auth.js.map +1 -1
- package/auth.mjs +12 -1
- package/auth.mjs.map +1 -1
- package/code-tool.d.mts +1 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +1 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +7 -8
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +8 -9
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +9 -3
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +9 -3
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +2 -4
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +2 -4
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts +1 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts +1 -1
- package/http.d.ts.map +1 -1
- package/http.js +16 -26
- package/http.js.map +1 -1
- package/http.mjs +17 -27
- package/http.mjs.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/instructions.d.mts +2 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +2 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +55 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +52 -0
- package/instructions.mjs.map +1 -0
- package/methods.d.mts.map +1 -1
- package/methods.d.ts.map +1 -1
- package/methods.js +0 -6
- package/methods.js.map +1 -1
- package/methods.mjs +0 -6
- package/methods.mjs.map +1 -1
- package/options.d.mts +1 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +1 -0
- package/options.d.ts.map +1 -1
- package/options.js +7 -0
- package/options.js.map +1 -1
- package/options.mjs +7 -0
- package/options.mjs.map +1 -1
- package/package.json +12 -2
- package/server.d.mts +8 -4
- package/server.d.mts.map +1 -1
- package/server.d.ts +8 -4
- package/server.d.ts.map +1 -1
- package/server.js +66 -46
- package/server.js.map +1 -1
- package/server.mjs +66 -46
- package/server.mjs.map +1 -1
- package/src/auth.ts +16 -1
- package/src/code-tool.ts +21 -12
- package/src/docs-search-tool.ts +9 -6
- package/src/http.ts +22 -26
- package/src/index.ts +1 -1
- package/src/instructions.ts +74 -0
- package/src/methods.ts +0 -6
- package/src/options.ts +9 -0
- package/src/server.ts +75 -61
- package/src/stdio.ts +2 -2
- package/src/types.ts +12 -4
- package/stdio.js +2 -2
- package/stdio.js.map +1 -1
- package/stdio.mjs +2 -2
- package/stdio.mjs.map +1 -1
- package/types.d.mts +8 -1
- package/types.d.mts.map +1 -1
- package/types.d.ts +8 -1
- package/types.d.ts.map +1 -1
- package/types.js.map +1 -1
- package/types.mjs.map +1 -1
package/src/methods.ts
CHANGED
|
@@ -425,12 +425,6 @@ export const sdkMethods: SdkMethod[] = [
|
|
|
425
425
|
httpMethod: 'get',
|
|
426
426
|
httpPath: '/version',
|
|
427
427
|
},
|
|
428
|
-
{
|
|
429
|
-
clientCallName: 'client.client.ws.test',
|
|
430
|
-
fullyQualifiedName: 'client.ws.test',
|
|
431
|
-
httpMethod: 'get',
|
|
432
|
-
httpPath: '/ws/test',
|
|
433
|
-
},
|
|
434
428
|
];
|
|
435
429
|
|
|
436
430
|
function allowedMethodsForCodeTool(options: McpOptions | undefined): SdkMethod[] | undefined {
|
package/src/options.ts
CHANGED
|
@@ -4,6 +4,7 @@ import qs from 'qs';
|
|
|
4
4
|
import yargs from 'yargs';
|
|
5
5
|
import { hideBin } from 'yargs/helpers';
|
|
6
6
|
import z from 'zod';
|
|
7
|
+
import { readEnv } from './util';
|
|
7
8
|
|
|
8
9
|
export type CLIOptions = McpOptions & {
|
|
9
10
|
debug: boolean;
|
|
@@ -14,6 +15,7 @@ export type CLIOptions = McpOptions & {
|
|
|
14
15
|
|
|
15
16
|
export type McpOptions = {
|
|
16
17
|
includeDocsTools?: boolean | undefined;
|
|
18
|
+
stainlessApiKey?: string | undefined;
|
|
17
19
|
codeAllowHttpGets?: boolean | undefined;
|
|
18
20
|
codeAllowedMethods?: string[] | undefined;
|
|
19
21
|
codeBlockedMethods?: string[] | undefined;
|
|
@@ -51,6 +53,12 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
51
53
|
description: 'Port to serve on if using http transport',
|
|
52
54
|
})
|
|
53
55
|
.option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
|
|
56
|
+
.option('stainless-api-key', {
|
|
57
|
+
type: 'string',
|
|
58
|
+
default: readEnv('STAINLESS_API_KEY'),
|
|
59
|
+
description:
|
|
60
|
+
'API key for Stainless. Used to authenticate requests to Stainless-hosted tools endpoints.',
|
|
61
|
+
})
|
|
54
62
|
.option('tools', {
|
|
55
63
|
type: 'string',
|
|
56
64
|
array: true,
|
|
@@ -81,6 +89,7 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
81
89
|
return {
|
|
82
90
|
...(includeDocsTools !== undefined && { includeDocsTools }),
|
|
83
91
|
debug: !!argv.debug,
|
|
92
|
+
stainlessApiKey: argv.stainlessApiKey,
|
|
84
93
|
codeAllowHttpGets: argv.codeAllowHttpGets,
|
|
85
94
|
codeAllowedMethods: argv.codeAllowedMethods,
|
|
86
95
|
codeBlockedMethods: argv.codeBlockedMethods,
|
package/src/server.ts
CHANGED
|
@@ -11,55 +11,19 @@ import { ClientOptions } from '@cjavdev/believe';
|
|
|
11
11
|
import Believe from '@cjavdev/believe';
|
|
12
12
|
import { codeTool } from './code-tool';
|
|
13
13
|
import docsSearchTool from './docs-search-tool';
|
|
14
|
+
import { getInstructions } from './instructions';
|
|
14
15
|
import { McpOptions } from './options';
|
|
15
16
|
import { blockedMethodsForCodeTool } from './methods';
|
|
16
|
-
import { HandlerFunction, McpTool } from './types';
|
|
17
|
-
import { readEnv } from './util';
|
|
17
|
+
import { HandlerFunction, McpRequestContext, ToolCallResult, McpTool } from './types';
|
|
18
18
|
|
|
19
|
-
async
|
|
20
|
-
// This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
|
|
21
|
-
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
|
22
|
-
const response = await fetch(
|
|
23
|
-
readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/believe',
|
|
24
|
-
{
|
|
25
|
-
method: 'GET',
|
|
26
|
-
headers: { ...(stainlessAPIKey && { Authorization: stainlessAPIKey }) },
|
|
27
|
-
},
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
let instructions: string | undefined;
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
console.warn(
|
|
33
|
-
'Warning: failed to retrieve MCP server instructions. Proceeding with default instructions...',
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
instructions = `
|
|
37
|
-
This is the believe MCP server. You will use Code Mode to help the user perform
|
|
38
|
-
actions. You can use search_docs tool to learn about how to take action with this server. Then,
|
|
39
|
-
you will write TypeScript code using the execute tool take action. It is CRITICAL that you be
|
|
40
|
-
thoughtful and deliberate when executing code. Always try to entirely solve the problem in code
|
|
41
|
-
block: it can be as long as you need to get the job done!
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
instructions ??= ((await response.json()) as { instructions: string }).instructions;
|
|
46
|
-
instructions = `
|
|
47
|
-
The current time in Unix timestamps is ${Date.now()}.
|
|
48
|
-
|
|
49
|
-
${instructions}
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
|
-
return instructions;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const newMcpServer = async () =>
|
|
19
|
+
export const newMcpServer = async (stainlessApiKey: string | undefined) =>
|
|
56
20
|
new McpServer(
|
|
57
21
|
{
|
|
58
22
|
name: 'cjavdev_believe_api',
|
|
59
|
-
version: '0.
|
|
23
|
+
version: '0.11.0',
|
|
60
24
|
},
|
|
61
25
|
{
|
|
62
|
-
instructions: await getInstructions(),
|
|
26
|
+
instructions: await getInstructions(stainlessApiKey),
|
|
63
27
|
capabilities: { tools: {}, logging: {} },
|
|
64
28
|
},
|
|
65
29
|
);
|
|
@@ -72,6 +36,7 @@ export async function initMcpServer(params: {
|
|
|
72
36
|
server: Server | McpServer;
|
|
73
37
|
clientOptions?: ClientOptions;
|
|
74
38
|
mcpOptions?: McpOptions;
|
|
39
|
+
stainlessApiKey?: string | undefined;
|
|
75
40
|
}) {
|
|
76
41
|
const server = params.server instanceof McpServer ? params.server.server : params.server;
|
|
77
42
|
|
|
@@ -90,14 +55,32 @@ export async function initMcpServer(params: {
|
|
|
90
55
|
error: logAtLevel('error'),
|
|
91
56
|
};
|
|
92
57
|
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
58
|
+
let _client: Believe | undefined;
|
|
59
|
+
let _clientError: Error | undefined;
|
|
60
|
+
let _logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off' | undefined;
|
|
61
|
+
|
|
62
|
+
const getClient = (): Believe => {
|
|
63
|
+
if (_clientError) throw _clientError;
|
|
64
|
+
if (!_client) {
|
|
65
|
+
try {
|
|
66
|
+
_client = new Believe({
|
|
67
|
+
logger,
|
|
68
|
+
...params.clientOptions,
|
|
69
|
+
defaultHeaders: {
|
|
70
|
+
...params.clientOptions?.defaultHeaders,
|
|
71
|
+
'X-Stainless-MCP': 'true',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
if (_logLevel) {
|
|
75
|
+
_client = _client.withOptions({ logLevel: _logLevel });
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
_clientError = e instanceof Error ? e : new Error(String(e));
|
|
79
|
+
throw _clientError;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return _client;
|
|
83
|
+
};
|
|
101
84
|
|
|
102
85
|
const providedTools = selectTools(params.mcpOptions);
|
|
103
86
|
const toolMap = Object.fromEntries(providedTools.map((mcpTool) => [mcpTool.tool.name, mcpTool]));
|
|
@@ -115,29 +98,56 @@ export async function initMcpServer(params: {
|
|
|
115
98
|
throw new Error(`Unknown tool: ${name}`);
|
|
116
99
|
}
|
|
117
100
|
|
|
118
|
-
|
|
101
|
+
let client: Believe;
|
|
102
|
+
try {
|
|
103
|
+
client = getClient();
|
|
104
|
+
} catch (error) {
|
|
105
|
+
return {
|
|
106
|
+
content: [
|
|
107
|
+
{
|
|
108
|
+
type: 'text' as const,
|
|
109
|
+
text: `Failed to initialize client: ${error instanceof Error ? error.message : String(error)}`,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
isError: true,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return executeHandler({
|
|
117
|
+
handler: mcpTool.handler,
|
|
118
|
+
reqContext: {
|
|
119
|
+
client,
|
|
120
|
+
stainlessApiKey: params.stainlessApiKey ?? params.mcpOptions?.stainlessApiKey,
|
|
121
|
+
},
|
|
122
|
+
args,
|
|
123
|
+
});
|
|
119
124
|
});
|
|
120
125
|
|
|
121
126
|
server.setRequestHandler(SetLevelRequestSchema, async (request) => {
|
|
122
127
|
const { level } = request.params;
|
|
128
|
+
let logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off';
|
|
123
129
|
switch (level) {
|
|
124
130
|
case 'debug':
|
|
125
|
-
|
|
131
|
+
logLevel = 'debug';
|
|
126
132
|
break;
|
|
127
133
|
case 'info':
|
|
128
|
-
|
|
134
|
+
logLevel = 'info';
|
|
129
135
|
break;
|
|
130
136
|
case 'notice':
|
|
131
137
|
case 'warning':
|
|
132
|
-
|
|
138
|
+
logLevel = 'warn';
|
|
133
139
|
break;
|
|
134
140
|
case 'error':
|
|
135
|
-
|
|
141
|
+
logLevel = 'error';
|
|
136
142
|
break;
|
|
137
143
|
default:
|
|
138
|
-
|
|
144
|
+
logLevel = 'off';
|
|
139
145
|
break;
|
|
140
146
|
}
|
|
147
|
+
_logLevel = logLevel;
|
|
148
|
+
if (_client) {
|
|
149
|
+
_client = _client.withOptions({ logLevel });
|
|
150
|
+
}
|
|
141
151
|
return {};
|
|
142
152
|
});
|
|
143
153
|
}
|
|
@@ -160,10 +170,14 @@ export function selectTools(options?: McpOptions): McpTool[] {
|
|
|
160
170
|
/**
|
|
161
171
|
* Runs the provided handler with the given client and arguments.
|
|
162
172
|
*/
|
|
163
|
-
export async function executeHandler(
|
|
164
|
-
handler
|
|
165
|
-
|
|
166
|
-
args
|
|
167
|
-
|
|
168
|
-
|
|
173
|
+
export async function executeHandler({
|
|
174
|
+
handler,
|
|
175
|
+
reqContext,
|
|
176
|
+
args,
|
|
177
|
+
}: {
|
|
178
|
+
handler: HandlerFunction;
|
|
179
|
+
reqContext: McpRequestContext;
|
|
180
|
+
args: Record<string, unknown> | undefined;
|
|
181
|
+
}): Promise<ToolCallResult> {
|
|
182
|
+
return await handler({ reqContext, args: args || {} });
|
|
169
183
|
}
|
package/src/stdio.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { McpOptions } from './options';
|
|
|
3
3
|
import { initMcpServer, newMcpServer } from './server';
|
|
4
4
|
|
|
5
5
|
export const launchStdioServer = async (mcpOptions: McpOptions) => {
|
|
6
|
-
const server = await newMcpServer();
|
|
6
|
+
const server = await newMcpServer(mcpOptions.stainlessApiKey);
|
|
7
7
|
|
|
8
|
-
await initMcpServer({ server, mcpOptions });
|
|
8
|
+
await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
|
|
9
9
|
|
|
10
10
|
const transport = new StdioServerTransport();
|
|
11
11
|
await server.connect(transport);
|
package/src/types.ts
CHANGED
|
@@ -42,10 +42,18 @@ export type ToolCallResult = {
|
|
|
42
42
|
isError?: boolean;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export type
|
|
46
|
-
client: Believe
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
export type McpRequestContext = {
|
|
46
|
+
client: Believe;
|
|
47
|
+
stainlessApiKey?: string | undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type HandlerFunction = ({
|
|
51
|
+
reqContext,
|
|
52
|
+
args,
|
|
53
|
+
}: {
|
|
54
|
+
reqContext: McpRequestContext;
|
|
55
|
+
args: Record<string, unknown> | undefined;
|
|
56
|
+
}) => Promise<ToolCallResult>;
|
|
49
57
|
|
|
50
58
|
export function asTextContentResult(result: unknown): ToolCallResult {
|
|
51
59
|
return {
|
package/stdio.js
CHANGED
|
@@ -4,8 +4,8 @@ exports.launchStdioServer = void 0;
|
|
|
4
4
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
5
|
const server_1 = require("./server.js");
|
|
6
6
|
const launchStdioServer = async (mcpOptions) => {
|
|
7
|
-
const server = await (0, server_1.newMcpServer)();
|
|
8
|
-
await (0, server_1.initMcpServer)({ server, mcpOptions });
|
|
7
|
+
const server = await (0, server_1.newMcpServer)(mcpOptions.stainlessApiKey);
|
|
8
|
+
await (0, server_1.initMcpServer)({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
|
|
9
9
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
10
10
|
await server.connect(transport);
|
|
11
11
|
console.error('MCP Server running on stdio');
|
package/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE9D,MAAM,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IAEzF,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
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
2
|
import { initMcpServer, newMcpServer } from "./server.mjs";
|
|
3
3
|
export const launchStdioServer = async (mcpOptions) => {
|
|
4
|
-
const server = await newMcpServer();
|
|
5
|
-
await initMcpServer({ server, mcpOptions });
|
|
4
|
+
const server = await newMcpServer(mcpOptions.stainlessApiKey);
|
|
5
|
+
await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
|
|
6
6
|
const transport = new StdioServerTransport();
|
|
7
7
|
await server.connect(transport);
|
|
8
8
|
console.error('MCP Server running on stdio');
|
package/stdio.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OAEzE,EAAE,aAAa,EAAE,YAAY,EAAE;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OAEzE,EAAE,aAAa,EAAE,YAAY,EAAE;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE9D,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IAEzF,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
CHANGED
|
@@ -31,7 +31,14 @@ export type ToolCallResult = {
|
|
|
31
31
|
content: ContentBlock[];
|
|
32
32
|
isError?: boolean;
|
|
33
33
|
};
|
|
34
|
-
export type
|
|
34
|
+
export type McpRequestContext = {
|
|
35
|
+
client: Believe;
|
|
36
|
+
stainlessApiKey?: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
export type HandlerFunction = ({ reqContext, args, }: {
|
|
39
|
+
reqContext: McpRequestContext;
|
|
40
|
+
args: Record<string, unknown> | undefined;
|
|
41
|
+
}) => Promise<ToolCallResult>;
|
|
35
42
|
export declare function asTextContentResult(result: unknown): ToolCallResult;
|
|
36
43
|
export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
|
|
37
44
|
export declare function asErrorResult(message: string): ToolCallResult;
|
package/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO,OAAO,MAAM,kBAAkB;OAC/B,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,KAAK,gBA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ACjB,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.d.ts
CHANGED
|
@@ -31,7 +31,14 @@ export type ToolCallResult = {
|
|
|
31
31
|
content: ContentBlock[];
|
|
32
32
|
isError?: boolean;
|
|
33
33
|
};
|
|
34
|
-
export type
|
|
34
|
+
export type McpRequestContext = {
|
|
35
|
+
client: Believe;
|
|
36
|
+
stainlessApiKey?: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
export type HandlerFunction = ({ reqContext, args, }: {
|
|
39
|
+
reqContext: McpRequestContext;
|
|
40
|
+
args: Record<string, unknown> | undefined;
|
|
41
|
+
}) => Promise<ToolCallResult>;
|
|
35
42
|
export declare function asTextContentResult(result: unknown): ToolCallResult;
|
|
36
43
|
export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
|
|
37
44
|
export declare function asErrorResult(message: string): ToolCallResult;
|
package/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO,OAAO,MAAM,kBAAkB;OAC/B,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;C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;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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":";AAAA,sFAAsF;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAyDtF,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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,sFAAsF;
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAyDtF,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,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