@constructorfleet/sketchforge3d 1.31.0 → 1.33.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/README.md +65 -3
- package/dist/cli.d.ts +3 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +97 -6
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +41 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +63 -0
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +39 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +105 -2
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/configurations.d.ts +21 -0
- package/dist/resources/configurations.d.ts.map +1 -0
- package/dist/resources/configurations.js +44 -0
- package/dist/resources/configurations.js.map +1 -0
- package/dist/resources/parameters.d.ts +16 -0
- package/dist/resources/parameters.d.ts.map +1 -0
- package/dist/resources/parameters.js +53 -0
- package/dist/resources/parameters.js.map +1 -0
- package/dist/resources/sketch-constraints.d.ts +11 -0
- package/dist/resources/sketch-constraints.d.ts.map +1 -0
- package/dist/resources/sketch-constraints.js +24 -0
- package/dist/resources/sketch-constraints.js.map +1 -0
- package/dist/types.d.ts +160 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/examples/parametric-box.macro.mjs +44 -0
- package/mcp/filesystemPaths.mjs +9 -2
- package/mcp/hosted.d.mts +10 -0
- package/mcp/hosted.mjs +79 -0
- package/mcp/localEngine.mjs +15 -6
- package/mcp/operation-parity.mjs +12 -1
- package/mcp/parameterTools.mjs +253 -0
- package/mcp/protocol.mjs +87 -0
- package/mcp/server.mjs +10 -960
- package/mcp/streamableHttp.mjs +116 -0
- package/mcp/toolCatalog.mjs +758 -0
- package/mcp/tools.mjs +296 -0
- package/package.json +2 -2
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs the parameter and expression tools over REST v1, or over the local engine.
|
|
3
|
+
*
|
|
4
|
+
* Both modes run one tool flow against a `request(method, path, { query, body })`.
|
|
5
|
+
* Local mode answers it with the engine's own REST helpers (`apiErrors`,
|
|
6
|
+
* `apiParameters`, `apiShapeSummary`), so replies and refusals match.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const PARAMETER_TOOL_NAMES = new Set([
|
|
10
|
+
"sketchforge_list_parameters",
|
|
11
|
+
"sketchforge_set_parameter",
|
|
12
|
+
"sketchforge_rename_parameter",
|
|
13
|
+
"sketchforge_delete_parameter",
|
|
14
|
+
"sketchforge_set_shape_expression",
|
|
15
|
+
"sketchforge_bind_sketch_constraint",
|
|
16
|
+
"sketchforge_list_parameter_configurations",
|
|
17
|
+
"sketchforge_create_parameter_configuration",
|
|
18
|
+
"sketchforge_rename_parameter_configuration",
|
|
19
|
+
"sketchforge_set_configuration_override",
|
|
20
|
+
"sketchforge_delete_parameter_configuration",
|
|
21
|
+
"sketchforge_activate_parameter_configuration",
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const CREATE_HINT = "Pass expression and dimension together to create it.";
|
|
25
|
+
|
|
26
|
+
/** Formats as `message [code]`, then the detail JSON on the next line. */
|
|
27
|
+
export class McpToolError extends Error {
|
|
28
|
+
constructor(headline, code, detail = {}) {
|
|
29
|
+
const extra = Object.keys(detail).length ? `\n${JSON.stringify(detail)}` : "";
|
|
30
|
+
super(`${headline}${code ? ` [${code}]` : ""}${extra}`);
|
|
31
|
+
this.headline = headline;
|
|
32
|
+
this.code = code;
|
|
33
|
+
this.detail = detail;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function withCreateHint(error) {
|
|
38
|
+
if (!(error instanceof McpToolError) || error.code !== "parameter_not_found") return error;
|
|
39
|
+
return new McpToolError(`${error.headline} ${CREATE_HINT}`, error.code, error.detail);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function requireText(args, key) {
|
|
43
|
+
if (typeof args[key] !== "string" || !args[key].trim()) throw new McpToolError(`${key} is required.`, "invalid_request");
|
|
44
|
+
return args[key];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Requires an expression string or null; shapeId is left to the request checks, as REST checks it. */
|
|
48
|
+
function requireExpression(args) {
|
|
49
|
+
if (args.expression !== null && typeof args.expression !== "string") {
|
|
50
|
+
throw new McpToolError("expression is required: an expression string, or null to clear the binding.", "invalid_request");
|
|
51
|
+
}
|
|
52
|
+
return args.expression;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Returns a configuration name bound for `?name=`. A query would stringify a
|
|
57
|
+
* number, so a non-string is refused here; a missing one is left to the request checks.
|
|
58
|
+
*/
|
|
59
|
+
function configurationQueryName(args) {
|
|
60
|
+
if (args.name !== undefined && args.name !== null && typeof args.name !== "string") {
|
|
61
|
+
throw new McpToolError("name must be a configuration name string.", "invalid_request");
|
|
62
|
+
}
|
|
63
|
+
return args.name;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Splits a set request into a create (both fields) or a change (either one). */
|
|
67
|
+
function parameterChanges(args) {
|
|
68
|
+
const changes = {
|
|
69
|
+
...(typeof args.expression === "string" ? { expression: args.expression } : {}),
|
|
70
|
+
...(typeof args.dimension === "string" ? { dimension: args.dimension } : {}),
|
|
71
|
+
};
|
|
72
|
+
if (!Object.keys(changes).length) throw new McpToolError("Pass expression, dimension, or both.", "invalid_request");
|
|
73
|
+
return { changes, create: "expression" in changes && "dimension" in changes };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Runs one parameter tool. `request` throws McpToolError for a refusal. */
|
|
77
|
+
export async function callParameterTool(name, args, request) {
|
|
78
|
+
const projectId = args.projectId;
|
|
79
|
+
switch (name) {
|
|
80
|
+
case "sketchforge_list_parameters":
|
|
81
|
+
return request("GET", "/parameters", { query: { projectId } });
|
|
82
|
+
case "sketchforge_set_parameter": {
|
|
83
|
+
const parameterName = requireText(args, "name");
|
|
84
|
+
const { changes, create } = parameterChanges(args);
|
|
85
|
+
// An upsert: an existing name is overwritten, not refused.
|
|
86
|
+
if (create) {
|
|
87
|
+
try {
|
|
88
|
+
return { created: true, ...await request("POST", "/parameters", { query: { projectId }, body: { name: parameterName, ...changes } }) };
|
|
89
|
+
} catch (error) {
|
|
90
|
+
if (!(error instanceof McpToolError) || error.code !== "parameter_exists") throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
return { created: false, ...await request("PATCH", "/parameters", { query: { projectId, name: parameterName }, body: changes }) };
|
|
95
|
+
} catch (error) {
|
|
96
|
+
throw create ? error : withCreateHint(error);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
case "sketchforge_rename_parameter":
|
|
100
|
+
return request("PATCH", "/parameters", {
|
|
101
|
+
query: { projectId, name: requireText(args, "name") },
|
|
102
|
+
body: { name: requireText(args, "newName") },
|
|
103
|
+
});
|
|
104
|
+
case "sketchforge_delete_parameter":
|
|
105
|
+
return request("DELETE", "/parameters", { query: { projectId, name: requireText(args, "name") } });
|
|
106
|
+
case "sketchforge_set_shape_expression": {
|
|
107
|
+
// field is a key of the body, not a query value, so it is checked here.
|
|
108
|
+
const field = requireText(args, "field");
|
|
109
|
+
const expression = requireExpression(args);
|
|
110
|
+
return request("PATCH", "/shapes", { query: { projectId, shapeId: args.shapeId }, body: { expressions: { [field]: expression } } });
|
|
111
|
+
}
|
|
112
|
+
case "sketchforge_bind_sketch_constraint": {
|
|
113
|
+
const expression = requireExpression(args);
|
|
114
|
+
return request("PATCH", "/sketch-constraints", { query: { projectId, shapeId: args.shapeId, constraintId: args.constraintId }, body: { expression } });
|
|
115
|
+
}
|
|
116
|
+
// Configuration bodies go to the request checks unread, so both modes refuse them as REST does.
|
|
117
|
+
case "sketchforge_list_parameter_configurations":
|
|
118
|
+
return request("GET", "/parameter-configurations", { query: { projectId } });
|
|
119
|
+
case "sketchforge_create_parameter_configuration":
|
|
120
|
+
return request("POST", "/parameter-configurations", { query: { projectId }, body: { name: args.name, overrides: args.overrides } });
|
|
121
|
+
case "sketchforge_rename_parameter_configuration":
|
|
122
|
+
return request("PATCH", "/parameter-configurations", { query: { projectId, name: configurationQueryName(args) }, body: { name: args.newName } });
|
|
123
|
+
case "sketchforge_set_configuration_override":
|
|
124
|
+
return request("PATCH", "/parameter-configurations", {
|
|
125
|
+
query: { projectId, name: configurationQueryName(args) },
|
|
126
|
+
body: { parameter: args.parameter, expression: args.expression },
|
|
127
|
+
});
|
|
128
|
+
case "sketchforge_delete_parameter_configuration":
|
|
129
|
+
return request("DELETE", "/parameter-configurations", { query: { projectId, name: configurationQueryName(args) } });
|
|
130
|
+
case "sketchforge_activate_parameter_configuration":
|
|
131
|
+
return request("POST", "/parameter-configurations/activate", { query: { projectId }, body: { name: args.name } });
|
|
132
|
+
default:
|
|
133
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** A query value as the URL carries it: absent, or a string. */
|
|
138
|
+
function queryText(value) {
|
|
139
|
+
return value === undefined || value === null ? undefined : String(value);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Answers the requests `callParameterTool` makes, as the REST v1 routes do.
|
|
144
|
+
* `api` is the engine package; its helpers are the ones the routes call.
|
|
145
|
+
*/
|
|
146
|
+
export function localParameterRequest(engine, api) {
|
|
147
|
+
const refusal = (reply) => new McpToolError(reply.message, reply.code, reply.detail);
|
|
148
|
+
const unwrap = async (result, toError = (failure) => api.engineFailureToApiError(failure)) => {
|
|
149
|
+
if (result.ok) return result.value;
|
|
150
|
+
throw refusal(toError(result.failure));
|
|
151
|
+
};
|
|
152
|
+
const requireProject = (query) => {
|
|
153
|
+
const projectId = api.apiProjectId(queryText(query.projectId));
|
|
154
|
+
if (!projectId) throw new McpToolError(api.API_ERROR_MESSAGES.invalidProjectId, "invalid_project_id");
|
|
155
|
+
return projectId;
|
|
156
|
+
};
|
|
157
|
+
const requireShape = (query) => {
|
|
158
|
+
const shapeId = api.apiShapeId(queryText(query.shapeId));
|
|
159
|
+
if (!shapeId) throw new McpToolError(api.API_ERROR_MESSAGES.shapeIdRequired, "invalid_shape_id");
|
|
160
|
+
return shapeId;
|
|
161
|
+
};
|
|
162
|
+
const requireConfigurationName = (query) => {
|
|
163
|
+
const configuration = api.apiConfigurationName(queryText(query.name));
|
|
164
|
+
if (configuration === undefined) throw new McpToolError(api.API_CONFIGURATION_MESSAGES.nameRequired, "invalid_request");
|
|
165
|
+
return configuration;
|
|
166
|
+
};
|
|
167
|
+
const requireName = (query) => {
|
|
168
|
+
const parameterName = api.apiParameterName(queryText(query.name));
|
|
169
|
+
if (!parameterName) throw new McpToolError(api.API_PARAMETER_MESSAGES.nameRequired, "invalid_request");
|
|
170
|
+
return parameterName;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
return async function request(method, route, { query = {}, body } = {}) {
|
|
174
|
+
// The same JSON a remote call would carry: undefined fields drop out.
|
|
175
|
+
const sent = body === undefined ? undefined : JSON.parse(JSON.stringify(body));
|
|
176
|
+
switch (`${method} ${route}`) {
|
|
177
|
+
case "GET /parameters":
|
|
178
|
+
return api.apiParameterList(await unwrap(await engine.project(requireProject(query))));
|
|
179
|
+
case "POST /parameters": {
|
|
180
|
+
const projectId = requireProject(query);
|
|
181
|
+
if (!api.isApiParameterCreateRequest(sent)) throw new McpToolError(api.API_PARAMETER_MESSAGES.create, "invalid_request");
|
|
182
|
+
return api.apiParametersWritten(await unwrap(await engine.addParameter(projectId, sent)), sent.name);
|
|
183
|
+
}
|
|
184
|
+
case "PATCH /parameters": {
|
|
185
|
+
const projectId = requireProject(query);
|
|
186
|
+
const parameterName = requireName(query);
|
|
187
|
+
if (!api.isApiParameterChangeRequest(sent)) throw new McpToolError(api.API_PARAMETER_MESSAGES.change, "invalid_request");
|
|
188
|
+
if (typeof sent.name === "string") {
|
|
189
|
+
return api.apiParametersWritten(await unwrap(await engine.renameParameter(projectId, parameterName, sent.name)), sent.name);
|
|
190
|
+
}
|
|
191
|
+
return api.apiParametersWritten(await unwrap(await engine.updateParameter(projectId, parameterName, sent)), parameterName);
|
|
192
|
+
}
|
|
193
|
+
case "DELETE /parameters": {
|
|
194
|
+
const projectId = requireProject(query);
|
|
195
|
+
const parameterName = requireName(query);
|
|
196
|
+
const { parameters, shapes, revision } = api.apiParametersWritten(await unwrap(await engine.deleteParameter(projectId, parameterName)), parameterName);
|
|
197
|
+
return { deleted: true, name: parameterName, parameters, shapes, revision };
|
|
198
|
+
}
|
|
199
|
+
case "PATCH /shapes": {
|
|
200
|
+
const projectId = requireProject(query);
|
|
201
|
+
const shapeId = requireShape(query);
|
|
202
|
+
const changed = await unwrap(
|
|
203
|
+
await engine.changeShape(projectId, shapeId, sent),
|
|
204
|
+
(failure) => api.shapeChangeApiError(failure, shapeId),
|
|
205
|
+
);
|
|
206
|
+
return api.apiShapeChanged(changed);
|
|
207
|
+
}
|
|
208
|
+
case "PATCH /sketch-constraints": {
|
|
209
|
+
const projectId = requireProject(query);
|
|
210
|
+
const shapeId = requireShape(query);
|
|
211
|
+
const constraintId = api.apiConstraintId(queryText(query.constraintId));
|
|
212
|
+
if (!constraintId) throw new McpToolError(api.API_SKETCH_CONSTRAINT_MESSAGES.constraintIdRequired, "invalid_request");
|
|
213
|
+
if (!api.isApiSketchConstraintBindRequest(sent)) throw new McpToolError(api.API_SKETCH_CONSTRAINT_MESSAGES.body, "invalid_request");
|
|
214
|
+
const bound = await unwrap(
|
|
215
|
+
await engine.bindSketchConstraint(projectId, shapeId, constraintId, sent.expression),
|
|
216
|
+
(failure) => api.sketchConstraintApiError(failure),
|
|
217
|
+
);
|
|
218
|
+
return api.apiSketchConstraintBound(bound, constraintId);
|
|
219
|
+
}
|
|
220
|
+
case "GET /parameter-configurations":
|
|
221
|
+
return api.apiConfigurationList(await unwrap(await engine.project(requireProject(query))));
|
|
222
|
+
case "POST /parameter-configurations": {
|
|
223
|
+
const projectId = requireProject(query);
|
|
224
|
+
if (!api.isApiConfigurationCreateRequest(sent)) throw new McpToolError(api.API_CONFIGURATION_MESSAGES.create, "invalid_request");
|
|
225
|
+
return api.apiConfigurationsWritten(await unwrap(await engine.addConfiguration(projectId, sent.name, sent.overrides)), sent.name);
|
|
226
|
+
}
|
|
227
|
+
case "PATCH /parameter-configurations": {
|
|
228
|
+
const projectId = requireProject(query);
|
|
229
|
+
const configuration = requireConfigurationName(query);
|
|
230
|
+
if (!api.isApiConfigurationChangeRequest(sent)) throw new McpToolError(api.API_CONFIGURATION_MESSAGES.change, "invalid_request");
|
|
231
|
+
if ("name" in sent) {
|
|
232
|
+
return api.apiConfigurationsWritten(await unwrap(await engine.renameConfiguration(projectId, configuration, sent.name)), sent.name);
|
|
233
|
+
}
|
|
234
|
+
const changed = sent.expression === null
|
|
235
|
+
? await engine.clearConfigurationOverride(projectId, configuration, sent.parameter)
|
|
236
|
+
: await engine.setConfigurationOverride(projectId, configuration, sent.parameter, sent.expression);
|
|
237
|
+
return api.apiConfigurationsWritten(await unwrap(changed), configuration);
|
|
238
|
+
}
|
|
239
|
+
case "DELETE /parameter-configurations": {
|
|
240
|
+
const projectId = requireProject(query);
|
|
241
|
+
const configuration = requireConfigurationName(query);
|
|
242
|
+
return { deleted: true, name: configuration, ...api.apiConfigurationsWritten(await unwrap(await engine.deleteConfiguration(projectId, configuration))) };
|
|
243
|
+
}
|
|
244
|
+
case "POST /parameter-configurations/activate": {
|
|
245
|
+
const projectId = requireProject(query);
|
|
246
|
+
if (!api.isApiConfigurationActivateRequest(sent)) throw new McpToolError(api.API_CONFIGURATION_MESSAGES.activate, "invalid_request");
|
|
247
|
+
return api.apiConfigurationsWritten(await unwrap(await engine.activateConfiguration(projectId, sent.name)));
|
|
248
|
+
}
|
|
249
|
+
default:
|
|
250
|
+
throw new Error(`No local route for ${method} ${route}.`);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
package/mcp/protocol.mjs
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
/**
|
|
5
|
+
* The version this bridge reports is the package's, read at startup rather than
|
|
6
|
+
* written here: it ships inside `@constructorfleet/sketchforge3d`, whose version
|
|
7
|
+
* tracks the app's, and a client that logs a hand-written number would say
|
|
8
|
+
* something untrue after the first release.
|
|
9
|
+
*/
|
|
10
|
+
const packageVersion = (() => {
|
|
11
|
+
try {
|
|
12
|
+
const manifest = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
13
|
+
const parsed = JSON.parse(readFileSync(manifest, "utf8"));
|
|
14
|
+
return typeof parsed.version === "string" ? parsed.version : "0.0.0";
|
|
15
|
+
} catch {
|
|
16
|
+
return "0.0.0";
|
|
17
|
+
}
|
|
18
|
+
})();
|
|
19
|
+
|
|
20
|
+
function textContent(value) {
|
|
21
|
+
return {
|
|
22
|
+
type: "text",
|
|
23
|
+
text: typeof value === "string" ? value : JSON.stringify(value, null, 2),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function toolResult(value) {
|
|
28
|
+
if (value?.dataUrl?.startsWith?.("data:image/png;base64,")) {
|
|
29
|
+
return {
|
|
30
|
+
content: [
|
|
31
|
+
textContent({ face: value.face, ...(value.view === undefined ? {} : { view: value.view }), bytesApprox: value.bytesApprox }),
|
|
32
|
+
{
|
|
33
|
+
type: "image",
|
|
34
|
+
data: value.dataUrl.slice("data:image/png;base64,".length),
|
|
35
|
+
mimeType: "image/png",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return { content: [textContent(value)] };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Lists newest first; initialize falls back to the first entry. */
|
|
44
|
+
export const SUPPORTED_PROTOCOL_VERSIONS = ["2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"];
|
|
45
|
+
|
|
46
|
+
function rpcResult(id, result) {
|
|
47
|
+
return { jsonrpc: "2.0", id, result };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function rpcError(id, code, message) {
|
|
51
|
+
return { jsonrpc: "2.0", id, error: { code, message } };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Builds the JSON-RPC handler shared by every transport; resolves undefined for notifications.
|
|
56
|
+
* Pass `version` when the package manifest is not on disk.
|
|
57
|
+
*/
|
|
58
|
+
export function createDispatcher({ tools, callTool, version = packageVersion }) {
|
|
59
|
+
return async function dispatch(message) {
|
|
60
|
+
if (!message || typeof message !== "object") return undefined;
|
|
61
|
+
const { id, method, params } = message;
|
|
62
|
+
if (id === undefined || id === null) return undefined;
|
|
63
|
+
try {
|
|
64
|
+
if (method === "initialize") {
|
|
65
|
+
const requested = params?.protocolVersion;
|
|
66
|
+
return rpcResult(id, {
|
|
67
|
+
protocolVersion: SUPPORTED_PROTOCOL_VERSIONS.includes(requested) ? requested : SUPPORTED_PROTOCOL_VERSIONS[0],
|
|
68
|
+
capabilities: { tools: {} },
|
|
69
|
+
serverInfo: { name: "sketchforge-mcp", version },
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (method === "ping") return rpcResult(id, {});
|
|
73
|
+
if (method === "tools/list") return rpcResult(id, { tools });
|
|
74
|
+
if (method === "tools/call") {
|
|
75
|
+
const name = params?.name;
|
|
76
|
+
if (typeof name !== "string") return rpcError(id, -32602, "Expected tool name");
|
|
77
|
+
return rpcResult(id, toolResult(await callTool(name, params?.arguments || {})));
|
|
78
|
+
}
|
|
79
|
+
if (method === "resources/list") return rpcResult(id, { resources: [] });
|
|
80
|
+
return rpcError(id, -32601, `Unknown method: ${method}`);
|
|
81
|
+
} catch (error) {
|
|
82
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
83
|
+
if (method === "tools/call") return rpcResult(id, { isError: true, content: [textContent(text)] });
|
|
84
|
+
return rpcError(id, -32000, text);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|