@phake/mcp 0.0.7 → 0.0.8
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.
|
@@ -1186,8 +1186,8 @@ function getSchemaShape(schema) {
|
|
|
1186
1186
|
if ("shape" in schema && typeof schema.shape === "object") {
|
|
1187
1187
|
return schema.shape;
|
|
1188
1188
|
}
|
|
1189
|
-
if ("
|
|
1190
|
-
const def = schema.
|
|
1189
|
+
if ("def" in schema && schema.def && typeof schema.def === "object") {
|
|
1190
|
+
const def = schema.def;
|
|
1191
1191
|
if (def.schema) {
|
|
1192
1192
|
return getSchemaShape(def.schema);
|
|
1193
1193
|
}
|
|
@@ -1256,10 +1256,16 @@ async function executeSharedTool(name, args, context, tools) {
|
|
|
1256
1256
|
isError: true
|
|
1257
1257
|
};
|
|
1258
1258
|
}
|
|
1259
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
1260
|
+
logger.error("execute_tool", {
|
|
1261
|
+
message: `Tool execution failed: ${err.message}`,
|
|
1262
|
+
tool: name,
|
|
1263
|
+
stack: err.stack
|
|
1264
|
+
});
|
|
1265
|
+
const message = `${err.name}: ${err.message}${err.stack ? `
|
|
1266
|
+
${err.stack}` : ""}`;
|
|
1259
1267
|
return {
|
|
1260
|
-
content: [
|
|
1261
|
-
{ type: "text", text: `Tool error: ${error.message}` }
|
|
1262
|
-
],
|
|
1268
|
+
content: [{ type: "text", text: `Tool error: ${message}` }],
|
|
1263
1269
|
isError: true
|
|
1264
1270
|
};
|
|
1265
1271
|
}
|
|
@@ -1383,6 +1389,7 @@ async function handleToolsList(ctx) {
|
|
|
1383
1389
|
},
|
|
1384
1390
|
...tool.annotations && { annotations: tool.annotations }
|
|
1385
1391
|
}));
|
|
1392
|
+
sharedLogger.info("[tools/list]", { message: `Exposing ${tools.length} tools`, tools: tools.map((t) => t.name) });
|
|
1386
1393
|
return { result: { tools } };
|
|
1387
1394
|
}
|
|
1388
1395
|
async function handleToolsCall(params, ctx, requestId) {
|
|
@@ -1436,15 +1443,17 @@ async function handleToolsCall(params, ctx, requestId) {
|
|
|
1436
1443
|
}
|
|
1437
1444
|
};
|
|
1438
1445
|
}
|
|
1446
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
1439
1447
|
sharedLogger.error("mcp_dispatch", {
|
|
1440
1448
|
message: "Tool execution failed",
|
|
1441
1449
|
tool: toolName,
|
|
1442
|
-
error:
|
|
1450
|
+
error: err.message,
|
|
1451
|
+
stack: err.stack
|
|
1443
1452
|
});
|
|
1444
1453
|
return {
|
|
1445
1454
|
error: {
|
|
1446
1455
|
code: JsonRpcErrorCode2.InternalError,
|
|
1447
|
-
message: `Tool execution failed: ${
|
|
1456
|
+
message: `Tool execution failed: ${err.name}: ${err.message}`
|
|
1448
1457
|
}
|
|
1449
1458
|
};
|
|
1450
1459
|
} finally {
|
package/dist/index.js
CHANGED
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
withCancellation,
|
|
84
84
|
withCors,
|
|
85
85
|
workerDiscoveryStrategy
|
|
86
|
-
} from "./index-
|
|
86
|
+
} from "./index-5jbpj7e0.js";
|
|
87
87
|
// src/shared/config/env.ts
|
|
88
88
|
function parseBoolean(value) {
|
|
89
89
|
return String(value || "false").toLowerCase() === "true";
|
|
@@ -29440,8 +29440,8 @@ function getSchemaShape(schema) {
|
|
|
29440
29440
|
if ("shape" in schema && typeof schema.shape === "object") {
|
|
29441
29441
|
return schema.shape;
|
|
29442
29442
|
}
|
|
29443
|
-
if ("
|
|
29444
|
-
const def = schema.
|
|
29443
|
+
if ("def" in schema && schema.def && typeof schema.def === "object") {
|
|
29444
|
+
const def = schema.def;
|
|
29445
29445
|
if (def.schema) {
|
|
29446
29446
|
return getSchemaShape(def.schema);
|
|
29447
29447
|
}
|
|
@@ -29504,10 +29504,16 @@ async function executeSharedTool(name, args, context, tools) {
|
|
|
29504
29504
|
isError: true
|
|
29505
29505
|
};
|
|
29506
29506
|
}
|
|
29507
|
+
const err = error48 instanceof Error ? error48 : new Error(String(error48));
|
|
29508
|
+
logger.error("execute_tool", {
|
|
29509
|
+
message: `Tool execution failed: ${err.message}`,
|
|
29510
|
+
tool: name,
|
|
29511
|
+
stack: err.stack
|
|
29512
|
+
});
|
|
29513
|
+
const message = `${err.name}: ${err.message}${err.stack ? `
|
|
29514
|
+
${err.stack}` : ""}`;
|
|
29507
29515
|
return {
|
|
29508
|
-
content: [
|
|
29509
|
-
{ type: "text", text: `Tool error: ${error48.message}` }
|
|
29510
|
-
],
|
|
29516
|
+
content: [{ type: "text", text: `Tool error: ${message}` }],
|
|
29511
29517
|
isError: true
|
|
29512
29518
|
};
|
|
29513
29519
|
}
|