@retell-ai/mcp-server 0.0.0 → 5.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 +94 -0
- package/auth.d.mts +6 -0
- package/auth.d.mts.map +1 -0
- package/auth.d.ts +6 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +34 -0
- package/auth.js.map +1 -0
- package/auth.mjs +29 -0
- package/auth.mjs.map +1 -0
- package/code-tool-paths.cjs +6 -0
- package/code-tool-paths.cjs.map +1 -0
- package/code-tool-paths.d.cts +2 -0
- package/code-tool-paths.d.cts.map +1 -0
- package/code-tool-types.d.mts +14 -0
- package/code-tool-types.d.mts.map +1 -0
- package/code-tool-types.d.ts +14 -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-worker.d.mts +5 -0
- package/code-tool-worker.d.mts.map +1 -0
- package/code-tool-worker.d.ts +5 -0
- package/code-tool-worker.d.ts.map +1 -0
- package/code-tool-worker.js +297 -0
- package/code-tool-worker.js.map +1 -0
- package/code-tool-worker.mjs +292 -0
- package/code-tool-worker.mjs.map +1 -0
- package/code-tool.d.mts +21 -0
- package/code-tool.d.mts.map +1 -0
- package/code-tool.d.ts +21 -0
- package/code-tool.d.ts.map +1 -0
- package/code-tool.js +333 -0
- package/code-tool.js.map +1 -0
- package/code-tool.mjs +294 -0
- package/code-tool.mjs.map +1 -0
- package/docs-search-tool.d.mts +57 -0
- package/docs-search-tool.d.mts.map +1 -0
- package/docs-search-tool.d.ts +57 -0
- package/docs-search-tool.d.ts.map +1 -0
- package/docs-search-tool.js +74 -0
- package/docs-search-tool.js.map +1 -0
- package/docs-search-tool.mjs +70 -0
- package/docs-search-tool.mjs.map +1 -0
- package/http.d.mts +12 -0
- package/http.d.mts.map +1 -0
- package/http.d.ts +12 -0
- package/http.d.ts.map +1 -0
- package/http.js +128 -0
- package/http.js.map +1 -0
- package/http.mjs +120 -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 +60 -0
- package/index.js.map +1 -0
- package/index.mjs +58 -0
- package/index.mjs.map +1 -0
- 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 +56 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +53 -0
- package/instructions.mjs.map +1 -0
- package/logger.d.mts +7 -0
- package/logger.d.mts.map +1 -0
- package/logger.d.ts +7 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +29 -0
- package/logger.js.map +1 -0
- package/logger.mjs +22 -0
- package/logger.mjs.map +1 -0
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +503 -0
- package/methods.js.map +1 -0
- package/methods.mjs +499 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +20 -0
- package/options.d.mts.map +1 -0
- package/options.d.ts +20 -0
- package/options.d.ts.map +1 -0
- package/options.js +122 -0
- package/options.js.map +1 -0
- package/options.mjs +115 -0
- package/options.mjs.map +1 -0
- package/package.json +217 -3
- package/server.d.mts +29 -0
- package/server.d.mts.map +1 -0
- package/server.d.ts +29 -0
- package/server.d.ts.map +1 -0
- package/server.js +160 -0
- package/server.js.map +1 -0
- package/server.mjs +150 -0
- package/server.mjs.map +1 -0
- package/src/auth.ts +38 -0
- package/src/code-tool-paths.cts +3 -0
- package/src/code-tool-types.ts +17 -0
- package/src/code-tool-worker.ts +343 -0
- package/src/code-tool.ts +382 -0
- package/src/docs-search-tool.ts +99 -0
- package/src/http.ts +159 -0
- package/src/index.ts +67 -0
- package/src/instructions.ts +75 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +524 -0
- package/src/options.ts +161 -0
- package/src/server.ts +190 -0
- package/src/stdio.ts +14 -0
- package/src/tsconfig.json +11 -0
- package/src/types.ts +123 -0
- package/src/util.ts +25 -0
- package/stdio.d.mts +3 -0
- package/stdio.d.mts.map +1 -0
- package/stdio.d.ts +3 -0
- package/stdio.d.ts.map +1 -0
- package/stdio.js +15 -0
- package/stdio.js.map +1 -0
- package/stdio.mjs +11 -0
- package/stdio.mjs.map +1 -0
- package/types.d.mts +59 -0
- package/types.d.mts.map +1 -0
- package/types.d.ts +59 -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/util.d.mts +4 -0
- package/util.d.mts.map +1 -0
- package/util.d.ts +4 -0
- package/util.d.ts.map +1 -0
- package/util.js +30 -0
- package/util.js.map +1 -0
- package/util.mjs +24 -0
- package/util.mjs.map +1 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { readEnv } from './util';
|
|
4
|
+
import { getLogger } from './logger';
|
|
5
|
+
|
|
6
|
+
const INSTRUCTIONS_CACHE_TTL_MS = 15 * 60 * 1000; // 15 minutes
|
|
7
|
+
|
|
8
|
+
interface InstructionsCacheEntry {
|
|
9
|
+
fetchedInstructions: string;
|
|
10
|
+
fetchedAt: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const instructionsCache = new Map<string, InstructionsCacheEntry>();
|
|
14
|
+
|
|
15
|
+
// Periodically evict stale entries so the cache doesn't grow unboundedly.
|
|
16
|
+
const _cacheCleanupInterval = setInterval(() => {
|
|
17
|
+
const now = Date.now();
|
|
18
|
+
for (const [key, entry] of instructionsCache) {
|
|
19
|
+
if (now - entry.fetchedAt > INSTRUCTIONS_CACHE_TTL_MS) {
|
|
20
|
+
instructionsCache.delete(key);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, INSTRUCTIONS_CACHE_TTL_MS);
|
|
24
|
+
|
|
25
|
+
// Don't keep the process alive just for cleanup.
|
|
26
|
+
_cacheCleanupInterval.unref();
|
|
27
|
+
|
|
28
|
+
export async function getInstructions(stainlessApiKey: string | undefined): Promise<string> {
|
|
29
|
+
const cacheKey = stainlessApiKey ?? '';
|
|
30
|
+
const cached = instructionsCache.get(cacheKey);
|
|
31
|
+
|
|
32
|
+
if (cached && Date.now() - cached.fetchedAt <= INSTRUCTIONS_CACHE_TTL_MS) {
|
|
33
|
+
return cached.fetchedInstructions;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const fetchedInstructions = await fetchLatestInstructions(stainlessApiKey);
|
|
37
|
+
instructionsCache.set(cacheKey, { fetchedInstructions, fetchedAt: Date.now() });
|
|
38
|
+
return fetchedInstructions;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function fetchLatestInstructions(stainlessApiKey: string | undefined): Promise<string> {
|
|
42
|
+
// Setting the stainless API key is optional, but may be required
|
|
43
|
+
// to authenticate requests to the Stainless API.
|
|
44
|
+
const response = await fetch(
|
|
45
|
+
readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/toddlzt',
|
|
46
|
+
{
|
|
47
|
+
method: 'GET',
|
|
48
|
+
headers: { ...(stainlessApiKey && { Authorization: stainlessApiKey }) },
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
let instructions: string | undefined;
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
getLogger().warn(
|
|
55
|
+
'Warning: failed to retrieve MCP server instructions. Proceeding with default instructions...',
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
instructions = `
|
|
59
|
+
This is the toddlzt MCP server. You will use Code Mode to help the user perform
|
|
60
|
+
actions. You can use search_docs tool to learn about how to take action with this server. Then,
|
|
61
|
+
you will write TypeScript code using the execute tool take action. It is CRITICAL that you be
|
|
62
|
+
thoughtful and deliberate when executing code. Always try to entirely solve the problem in code
|
|
63
|
+
block: it can be as long as you need to get the job done!
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
instructions ??= ((await response.json()) as { instructions: string }).instructions;
|
|
68
|
+
instructions = `
|
|
69
|
+
If needed, you can get the current time by executing Date.now().
|
|
70
|
+
|
|
71
|
+
${instructions}
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
return instructions;
|
|
75
|
+
}
|
package/src/logger.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { pino, type Level, type Logger } from 'pino';
|
|
4
|
+
import pretty from 'pino-pretty';
|
|
5
|
+
|
|
6
|
+
let _logger: Logger | undefined;
|
|
7
|
+
|
|
8
|
+
export function configureLogger({ level, pretty: usePretty }: { level: Level; pretty: boolean }): void {
|
|
9
|
+
_logger = pino(
|
|
10
|
+
{
|
|
11
|
+
level,
|
|
12
|
+
timestamp: pino.stdTimeFunctions.isoTime,
|
|
13
|
+
formatters: {
|
|
14
|
+
level(label) {
|
|
15
|
+
return { level: label };
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
usePretty ? pretty({ colorize: true, levelFirst: true, destination: 2 }) : process.stderr,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getLogger(): Logger {
|
|
24
|
+
if (!_logger) {
|
|
25
|
+
throw new Error('Logger has not been configured. Call configureLogger() before using the logger.');
|
|
26
|
+
}
|
|
27
|
+
return _logger;
|
|
28
|
+
}
|
package/src/methods.ts
ADDED
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { McpOptions } from './options';
|
|
4
|
+
|
|
5
|
+
export type SdkMethod = {
|
|
6
|
+
clientCallName: string;
|
|
7
|
+
fullyQualifiedName: string;
|
|
8
|
+
httpMethod?: 'get' | 'post' | 'put' | 'patch' | 'delete' | 'query';
|
|
9
|
+
httpPath?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const sdkMethods: SdkMethod[] = [
|
|
13
|
+
{
|
|
14
|
+
clientCallName: 'client.call.retrieve',
|
|
15
|
+
fullyQualifiedName: 'call.retrieve',
|
|
16
|
+
httpMethod: 'get',
|
|
17
|
+
httpPath: '/v2/get-call/{call_id}',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
clientCallName: 'client.call.update',
|
|
21
|
+
fullyQualifiedName: 'call.update',
|
|
22
|
+
httpMethod: 'patch',
|
|
23
|
+
httpPath: '/v2/update-call/{call_id}',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
clientCallName: 'client.call.list',
|
|
27
|
+
fullyQualifiedName: 'call.list',
|
|
28
|
+
httpMethod: 'post',
|
|
29
|
+
httpPath: '/v2/list-calls',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
clientCallName: 'client.call.delete',
|
|
33
|
+
fullyQualifiedName: 'call.delete',
|
|
34
|
+
httpMethod: 'delete',
|
|
35
|
+
httpPath: '/v2/delete-call/{call_id}',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
clientCallName: 'client.call.createPhoneCall',
|
|
39
|
+
fullyQualifiedName: 'call.createPhoneCall',
|
|
40
|
+
httpMethod: 'post',
|
|
41
|
+
httpPath: '/v2/create-phone-call',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
clientCallName: 'client.call.createWebCall',
|
|
45
|
+
fullyQualifiedName: 'call.createWebCall',
|
|
46
|
+
httpMethod: 'post',
|
|
47
|
+
httpPath: '/v2/create-web-call',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
clientCallName: 'client.call.registerPhoneCall',
|
|
51
|
+
fullyQualifiedName: 'call.registerPhoneCall',
|
|
52
|
+
httpMethod: 'post',
|
|
53
|
+
httpPath: '/v2/register-phone-call',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
clientCallName: 'client.chat.create',
|
|
57
|
+
fullyQualifiedName: 'chat.create',
|
|
58
|
+
httpMethod: 'post',
|
|
59
|
+
httpPath: '/create-chat',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
clientCallName: 'client.chat.retrieve',
|
|
63
|
+
fullyQualifiedName: 'chat.retrieve',
|
|
64
|
+
httpMethod: 'get',
|
|
65
|
+
httpPath: '/get-chat/{chat_id}',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
clientCallName: 'client.chat.update',
|
|
69
|
+
fullyQualifiedName: 'chat.update',
|
|
70
|
+
httpMethod: 'patch',
|
|
71
|
+
httpPath: '/update-chat/{chat_id}',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
clientCallName: 'client.chat.list',
|
|
75
|
+
fullyQualifiedName: 'chat.list',
|
|
76
|
+
httpMethod: 'get',
|
|
77
|
+
httpPath: '/list-chat',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
clientCallName: 'client.chat.createChatCompletion',
|
|
81
|
+
fullyQualifiedName: 'chat.createChatCompletion',
|
|
82
|
+
httpMethod: 'post',
|
|
83
|
+
httpPath: '/create-chat-completion',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
clientCallName: 'client.chat.createSMSChat',
|
|
87
|
+
fullyQualifiedName: 'chat.createSMSChat',
|
|
88
|
+
httpMethod: 'post',
|
|
89
|
+
httpPath: '/create-sms-chat',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
clientCallName: 'client.chat.end',
|
|
93
|
+
fullyQualifiedName: 'chat.end',
|
|
94
|
+
httpMethod: 'patch',
|
|
95
|
+
httpPath: '/end-chat/{chat_id}',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
clientCallName: 'client.phoneNumber.create',
|
|
99
|
+
fullyQualifiedName: 'phoneNumber.create',
|
|
100
|
+
httpMethod: 'post',
|
|
101
|
+
httpPath: '/create-phone-number',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
clientCallName: 'client.phoneNumber.retrieve',
|
|
105
|
+
fullyQualifiedName: 'phoneNumber.retrieve',
|
|
106
|
+
httpMethod: 'get',
|
|
107
|
+
httpPath: '/get-phone-number/{phone_number}',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
clientCallName: 'client.phoneNumber.update',
|
|
111
|
+
fullyQualifiedName: 'phoneNumber.update',
|
|
112
|
+
httpMethod: 'patch',
|
|
113
|
+
httpPath: '/update-phone-number/{phone_number}',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
clientCallName: 'client.phoneNumber.list',
|
|
117
|
+
fullyQualifiedName: 'phoneNumber.list',
|
|
118
|
+
httpMethod: 'get',
|
|
119
|
+
httpPath: '/list-phone-numbers',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
clientCallName: 'client.phoneNumber.delete',
|
|
123
|
+
fullyQualifiedName: 'phoneNumber.delete',
|
|
124
|
+
httpMethod: 'delete',
|
|
125
|
+
httpPath: '/delete-phone-number/{phone_number}',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
clientCallName: 'client.phoneNumber.import',
|
|
129
|
+
fullyQualifiedName: 'phoneNumber.import',
|
|
130
|
+
httpMethod: 'post',
|
|
131
|
+
httpPath: '/import-phone-number',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
clientCallName: 'client.agent.create',
|
|
135
|
+
fullyQualifiedName: 'agent.create',
|
|
136
|
+
httpMethod: 'post',
|
|
137
|
+
httpPath: '/create-agent',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
clientCallName: 'client.agent.retrieve',
|
|
141
|
+
fullyQualifiedName: 'agent.retrieve',
|
|
142
|
+
httpMethod: 'get',
|
|
143
|
+
httpPath: '/get-agent/{agent_id}',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
clientCallName: 'client.agent.update',
|
|
147
|
+
fullyQualifiedName: 'agent.update',
|
|
148
|
+
httpMethod: 'patch',
|
|
149
|
+
httpPath: '/update-agent/{agent_id}',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
clientCallName: 'client.agent.list',
|
|
153
|
+
fullyQualifiedName: 'agent.list',
|
|
154
|
+
httpMethod: 'get',
|
|
155
|
+
httpPath: '/list-agents',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
clientCallName: 'client.agent.delete',
|
|
159
|
+
fullyQualifiedName: 'agent.delete',
|
|
160
|
+
httpMethod: 'delete',
|
|
161
|
+
httpPath: '/delete-agent/{agent_id}',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
clientCallName: 'client.agent.getVersions',
|
|
165
|
+
fullyQualifiedName: 'agent.getVersions',
|
|
166
|
+
httpMethod: 'get',
|
|
167
|
+
httpPath: '/get-agent-versions/{agent_id}',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
clientCallName: 'client.agent.publish',
|
|
171
|
+
fullyQualifiedName: 'agent.publish',
|
|
172
|
+
httpMethod: 'post',
|
|
173
|
+
httpPath: '/publish-agent/{agent_id}',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
clientCallName: 'client.chatAgent.create',
|
|
177
|
+
fullyQualifiedName: 'chatAgent.create',
|
|
178
|
+
httpMethod: 'post',
|
|
179
|
+
httpPath: '/create-chat-agent',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
clientCallName: 'client.chatAgent.retrieve',
|
|
183
|
+
fullyQualifiedName: 'chatAgent.retrieve',
|
|
184
|
+
httpMethod: 'get',
|
|
185
|
+
httpPath: '/get-chat-agent/{agent_id}',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
clientCallName: 'client.chatAgent.update',
|
|
189
|
+
fullyQualifiedName: 'chatAgent.update',
|
|
190
|
+
httpMethod: 'patch',
|
|
191
|
+
httpPath: '/update-chat-agent/{agent_id}',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
clientCallName: 'client.chatAgent.list',
|
|
195
|
+
fullyQualifiedName: 'chatAgent.list',
|
|
196
|
+
httpMethod: 'get',
|
|
197
|
+
httpPath: '/list-chat-agents',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
clientCallName: 'client.chatAgent.delete',
|
|
201
|
+
fullyQualifiedName: 'chatAgent.delete',
|
|
202
|
+
httpMethod: 'delete',
|
|
203
|
+
httpPath: '/delete-chat-agent/{agent_id}',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
clientCallName: 'client.chatAgent.getVersions',
|
|
207
|
+
fullyQualifiedName: 'chatAgent.getVersions',
|
|
208
|
+
httpMethod: 'get',
|
|
209
|
+
httpPath: '/get-chat-agent-versions/{agent_id}',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
clientCallName: 'client.chatAgent.publish',
|
|
213
|
+
fullyQualifiedName: 'chatAgent.publish',
|
|
214
|
+
httpMethod: 'post',
|
|
215
|
+
httpPath: '/publish-chat-agent/{agent_id}',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
clientCallName: 'client.llm.create',
|
|
219
|
+
fullyQualifiedName: 'llm.create',
|
|
220
|
+
httpMethod: 'post',
|
|
221
|
+
httpPath: '/create-retell-llm',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
clientCallName: 'client.llm.retrieve',
|
|
225
|
+
fullyQualifiedName: 'llm.retrieve',
|
|
226
|
+
httpMethod: 'get',
|
|
227
|
+
httpPath: '/get-retell-llm/{llm_id}',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
clientCallName: 'client.llm.update',
|
|
231
|
+
fullyQualifiedName: 'llm.update',
|
|
232
|
+
httpMethod: 'patch',
|
|
233
|
+
httpPath: '/update-retell-llm/{llm_id}',
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
clientCallName: 'client.llm.list',
|
|
237
|
+
fullyQualifiedName: 'llm.list',
|
|
238
|
+
httpMethod: 'get',
|
|
239
|
+
httpPath: '/list-retell-llms',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
clientCallName: 'client.llm.delete',
|
|
243
|
+
fullyQualifiedName: 'llm.delete',
|
|
244
|
+
httpMethod: 'delete',
|
|
245
|
+
httpPath: '/delete-retell-llm/{llm_id}',
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
clientCallName: 'client.conversationFlow.create',
|
|
249
|
+
fullyQualifiedName: 'conversationFlow.create',
|
|
250
|
+
httpMethod: 'post',
|
|
251
|
+
httpPath: '/create-conversation-flow',
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
clientCallName: 'client.conversationFlow.retrieve',
|
|
255
|
+
fullyQualifiedName: 'conversationFlow.retrieve',
|
|
256
|
+
httpMethod: 'get',
|
|
257
|
+
httpPath: '/get-conversation-flow/{conversation_flow_id}',
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
clientCallName: 'client.conversationFlow.update',
|
|
261
|
+
fullyQualifiedName: 'conversationFlow.update',
|
|
262
|
+
httpMethod: 'patch',
|
|
263
|
+
httpPath: '/update-conversation-flow/{conversation_flow_id}',
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
clientCallName: 'client.conversationFlow.list',
|
|
267
|
+
fullyQualifiedName: 'conversationFlow.list',
|
|
268
|
+
httpMethod: 'get',
|
|
269
|
+
httpPath: '/list-conversation-flows',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
clientCallName: 'client.conversationFlow.delete',
|
|
273
|
+
fullyQualifiedName: 'conversationFlow.delete',
|
|
274
|
+
httpMethod: 'delete',
|
|
275
|
+
httpPath: '/delete-conversation-flow/{conversation_flow_id}',
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
clientCallName: 'client.conversationFlowComponent.create',
|
|
279
|
+
fullyQualifiedName: 'conversationFlowComponent.create',
|
|
280
|
+
httpMethod: 'post',
|
|
281
|
+
httpPath: '/create-conversation-flow-component',
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
clientCallName: 'client.conversationFlowComponent.retrieve',
|
|
285
|
+
fullyQualifiedName: 'conversationFlowComponent.retrieve',
|
|
286
|
+
httpMethod: 'get',
|
|
287
|
+
httpPath: '/get-conversation-flow-component/{conversation_flow_component_id}',
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
clientCallName: 'client.conversationFlowComponent.update',
|
|
291
|
+
fullyQualifiedName: 'conversationFlowComponent.update',
|
|
292
|
+
httpMethod: 'patch',
|
|
293
|
+
httpPath: '/update-conversation-flow-component/{conversation_flow_component_id}',
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
clientCallName: 'client.conversationFlowComponent.list',
|
|
297
|
+
fullyQualifiedName: 'conversationFlowComponent.list',
|
|
298
|
+
httpMethod: 'get',
|
|
299
|
+
httpPath: '/list-conversation-flow-components',
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
clientCallName: 'client.conversationFlowComponent.delete',
|
|
303
|
+
fullyQualifiedName: 'conversationFlowComponent.delete',
|
|
304
|
+
httpMethod: 'delete',
|
|
305
|
+
httpPath: '/delete-conversation-flow-component/{conversation_flow_component_id}',
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
clientCallName: 'client.knowledgeBase.create',
|
|
309
|
+
fullyQualifiedName: 'knowledgeBase.create',
|
|
310
|
+
httpMethod: 'post',
|
|
311
|
+
httpPath: '/create-knowledge-base',
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
clientCallName: 'client.knowledgeBase.retrieve',
|
|
315
|
+
fullyQualifiedName: 'knowledgeBase.retrieve',
|
|
316
|
+
httpMethod: 'get',
|
|
317
|
+
httpPath: '/get-knowledge-base/{knowledge_base_id}',
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
clientCallName: 'client.knowledgeBase.list',
|
|
321
|
+
fullyQualifiedName: 'knowledgeBase.list',
|
|
322
|
+
httpMethod: 'get',
|
|
323
|
+
httpPath: '/list-knowledge-bases',
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
clientCallName: 'client.knowledgeBase.delete',
|
|
327
|
+
fullyQualifiedName: 'knowledgeBase.delete',
|
|
328
|
+
httpMethod: 'delete',
|
|
329
|
+
httpPath: '/delete-knowledge-base/{knowledge_base_id}',
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
clientCallName: 'client.knowledgeBase.addSources',
|
|
333
|
+
fullyQualifiedName: 'knowledgeBase.addSources',
|
|
334
|
+
httpMethod: 'post',
|
|
335
|
+
httpPath: '/add-knowledge-base-sources/{knowledge_base_id}',
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
clientCallName: 'client.knowledgeBase.deleteSource',
|
|
339
|
+
fullyQualifiedName: 'knowledgeBase.deleteSource',
|
|
340
|
+
httpMethod: 'delete',
|
|
341
|
+
httpPath: '/delete-knowledge-base-source/{knowledge_base_id}/source/{source_id}',
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
clientCallName: 'client.voice.retrieve',
|
|
345
|
+
fullyQualifiedName: 'voice.retrieve',
|
|
346
|
+
httpMethod: 'get',
|
|
347
|
+
httpPath: '/get-voice/{voice_id}',
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
clientCallName: 'client.voice.list',
|
|
351
|
+
fullyQualifiedName: 'voice.list',
|
|
352
|
+
httpMethod: 'get',
|
|
353
|
+
httpPath: '/list-voices',
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
clientCallName: 'client.voice.addResource',
|
|
357
|
+
fullyQualifiedName: 'voice.addResource',
|
|
358
|
+
httpMethod: 'post',
|
|
359
|
+
httpPath: '/add-community-voice',
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
clientCallName: 'client.voice.clone',
|
|
363
|
+
fullyQualifiedName: 'voice.clone',
|
|
364
|
+
httpMethod: 'post',
|
|
365
|
+
httpPath: '/clone-voice',
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
clientCallName: 'client.voice.search',
|
|
369
|
+
fullyQualifiedName: 'voice.search',
|
|
370
|
+
httpMethod: 'post',
|
|
371
|
+
httpPath: '/search-community-voice',
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
clientCallName: 'client.concurrency.retrieve',
|
|
375
|
+
fullyQualifiedName: 'concurrency.retrieve',
|
|
376
|
+
httpMethod: 'get',
|
|
377
|
+
httpPath: '/get-concurrency',
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
clientCallName: 'client.batchCall.createBatchCall',
|
|
381
|
+
fullyQualifiedName: 'batchCall.createBatchCall',
|
|
382
|
+
httpMethod: 'post',
|
|
383
|
+
httpPath: '/create-batch-call',
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
clientCallName: 'client.tests.createBatchTest',
|
|
387
|
+
fullyQualifiedName: 'tests.createBatchTest',
|
|
388
|
+
httpMethod: 'post',
|
|
389
|
+
httpPath: '/create-batch-test',
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
clientCallName: 'client.tests.createTestCaseDefinition',
|
|
393
|
+
fullyQualifiedName: 'tests.createTestCaseDefinition',
|
|
394
|
+
httpMethod: 'post',
|
|
395
|
+
httpPath: '/create-test-case-definition',
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
clientCallName: 'client.tests.deleteTestCaseDefinition',
|
|
399
|
+
fullyQualifiedName: 'tests.deleteTestCaseDefinition',
|
|
400
|
+
httpMethod: 'delete',
|
|
401
|
+
httpPath: '/delete-test-case-definition/{test_case_definition_id}',
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
clientCallName: 'client.tests.getBatchTest',
|
|
405
|
+
fullyQualifiedName: 'tests.getBatchTest',
|
|
406
|
+
httpMethod: 'get',
|
|
407
|
+
httpPath: '/get-batch-test/{test_case_batch_job_id}',
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
clientCallName: 'client.tests.getTestCaseDefinition',
|
|
411
|
+
fullyQualifiedName: 'tests.getTestCaseDefinition',
|
|
412
|
+
httpMethod: 'get',
|
|
413
|
+
httpPath: '/get-test-case-definition/{test_case_definition_id}',
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
clientCallName: 'client.tests.getTestRun',
|
|
417
|
+
fullyQualifiedName: 'tests.getTestRun',
|
|
418
|
+
httpMethod: 'get',
|
|
419
|
+
httpPath: '/get-test-run/{test_case_job_id}',
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
clientCallName: 'client.tests.listBatchTests',
|
|
423
|
+
fullyQualifiedName: 'tests.listBatchTests',
|
|
424
|
+
httpMethod: 'get',
|
|
425
|
+
httpPath: '/list-batch-tests',
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
clientCallName: 'client.tests.listTestCaseDefinitions',
|
|
429
|
+
fullyQualifiedName: 'tests.listTestCaseDefinitions',
|
|
430
|
+
httpMethod: 'get',
|
|
431
|
+
httpPath: '/list-test-case-definitions',
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
clientCallName: 'client.tests.listTestRuns',
|
|
435
|
+
fullyQualifiedName: 'tests.listTestRuns',
|
|
436
|
+
httpMethod: 'get',
|
|
437
|
+
httpPath: '/list-test-runs/{test_case_batch_job_id}',
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
clientCallName: 'client.tests.updateTestCaseDefinition',
|
|
441
|
+
fullyQualifiedName: 'tests.updateTestCaseDefinition',
|
|
442
|
+
httpMethod: 'put',
|
|
443
|
+
httpPath: '/update-test-case-definition/{test_case_definition_id}',
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
clientCallName: 'client.mcpTool.getMcpTools',
|
|
447
|
+
fullyQualifiedName: 'mcpTool.getMcpTools',
|
|
448
|
+
httpMethod: 'get',
|
|
449
|
+
httpPath: '/get-mcp-tools/{agent_id}',
|
|
450
|
+
},
|
|
451
|
+
];
|
|
452
|
+
|
|
453
|
+
function allowedMethodsForCodeTool(options: McpOptions | undefined): SdkMethod[] | undefined {
|
|
454
|
+
if (!options) {
|
|
455
|
+
return undefined;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
let allowedMethods: SdkMethod[];
|
|
459
|
+
|
|
460
|
+
if (options.codeAllowHttpGets || options.codeAllowedMethods) {
|
|
461
|
+
// Start with nothing allowed and then add into it from options
|
|
462
|
+
let allowedMethodsSet = new Set<SdkMethod>();
|
|
463
|
+
|
|
464
|
+
if (options.codeAllowHttpGets) {
|
|
465
|
+
// Add all methods that map to an HTTP GET
|
|
466
|
+
sdkMethods
|
|
467
|
+
.filter((method) => method.httpMethod === 'get')
|
|
468
|
+
.forEach((method) => allowedMethodsSet.add(method));
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if (options.codeAllowedMethods) {
|
|
472
|
+
// Add all methods that match any of the allowed regexps
|
|
473
|
+
const allowedRegexps = options.codeAllowedMethods.map((pattern) => {
|
|
474
|
+
try {
|
|
475
|
+
return new RegExp(pattern);
|
|
476
|
+
} catch (e) {
|
|
477
|
+
throw new Error(
|
|
478
|
+
`Invalid regex pattern for allowed method: "${pattern}": ${e instanceof Error ? e.message : e}`,
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
sdkMethods
|
|
484
|
+
.filter((method) => allowedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)))
|
|
485
|
+
.forEach((method) => allowedMethodsSet.add(method));
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
allowedMethods = Array.from(allowedMethodsSet);
|
|
489
|
+
} else {
|
|
490
|
+
// Start with everything allowed
|
|
491
|
+
allowedMethods = [...sdkMethods];
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (options.codeBlockedMethods) {
|
|
495
|
+
// Filter down based on blocked regexps
|
|
496
|
+
const blockedRegexps = options.codeBlockedMethods.map((pattern) => {
|
|
497
|
+
try {
|
|
498
|
+
return new RegExp(pattern);
|
|
499
|
+
} catch (e) {
|
|
500
|
+
throw new Error(
|
|
501
|
+
`Invalid regex pattern for blocked method: "${pattern}": ${e instanceof Error ? e.message : e}`,
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
allowedMethods = allowedMethods.filter(
|
|
507
|
+
(method) => !blockedRegexps.some((regexp) => regexp.test(method.fullyQualifiedName)),
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
return allowedMethods;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export function blockedMethodsForCodeTool(options: McpOptions | undefined): SdkMethod[] | undefined {
|
|
515
|
+
const allowedMethods = allowedMethodsForCodeTool(options);
|
|
516
|
+
if (!allowedMethods) {
|
|
517
|
+
return undefined;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
const allowedSet = new Set(allowedMethods.map((method) => method.fullyQualifiedName));
|
|
521
|
+
|
|
522
|
+
// Return any methods that are not explicitly allowed
|
|
523
|
+
return sdkMethods.filter((method) => !allowedSet.has(method.fullyQualifiedName));
|
|
524
|
+
}
|