@inkeep/agents-run-api 0.22.5 → 0.22.7

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/dist/index.cjs CHANGED
@@ -8024,6 +8024,46 @@ var Agent = class {
8024
8024
  logger19.debug({ toolName, toolCallId }, "MCP Tool Called");
8025
8025
  try {
8026
8026
  const rawResult = await originalTool.execute(args, { toolCallId });
8027
+ if (rawResult && typeof rawResult === "object" && "isError" in rawResult && rawResult.isError) {
8028
+ const errorMessage = rawResult.content?.[0]?.text || "MCP tool returned an error";
8029
+ logger19.error(
8030
+ { toolName, toolCallId, errorMessage, rawResult },
8031
+ "MCP tool returned error status"
8032
+ );
8033
+ toolSessionManager.recordToolResult(sessionId, {
8034
+ toolCallId,
8035
+ toolName,
8036
+ args,
8037
+ result: { error: errorMessage, failed: true },
8038
+ timestamp: Date.now()
8039
+ });
8040
+ if (streamRequestId) {
8041
+ agentSessionManager.recordEvent(streamRequestId, "error", this.config.id, {
8042
+ message: `MCP tool "${toolName}" failed: ${errorMessage}`,
8043
+ code: "mcp_tool_error",
8044
+ severity: "error",
8045
+ context: {
8046
+ toolName,
8047
+ toolCallId,
8048
+ errorMessage
8049
+ }
8050
+ });
8051
+ }
8052
+ const activeSpan = api.trace.getActiveSpan();
8053
+ if (activeSpan) {
8054
+ const error = new Error(
8055
+ `Tool "${toolName}" failed: ${errorMessage}. This tool is currently unavailable. Please try a different approach or inform the user of the issue.`
8056
+ );
8057
+ activeSpan.recordException(error);
8058
+ activeSpan.setStatus({
8059
+ code: api.SpanStatusCode.ERROR,
8060
+ message: `MCP tool returned error: ${errorMessage}`
8061
+ });
8062
+ }
8063
+ throw new Error(
8064
+ `Tool "${toolName}" failed: ${errorMessage}. This tool is currently unavailable. Please try a different approach or inform the user of the issue.`
8065
+ );
8066
+ }
8027
8067
  const parsedResult = parseEmbeddedJson(rawResult);
8028
8068
  const enhancedResult = this.enhanceToolResultWithStructureHints(parsedResult);
8029
8069
  toolSessionManager.recordToolResult(sessionId, {
package/dist/index.js CHANGED
@@ -6770,6 +6770,46 @@ var Agent = class {
6770
6770
  logger15.debug({ toolName, toolCallId }, "MCP Tool Called");
6771
6771
  try {
6772
6772
  const rawResult = await originalTool.execute(args, { toolCallId });
6773
+ if (rawResult && typeof rawResult === "object" && "isError" in rawResult && rawResult.isError) {
6774
+ const errorMessage = rawResult.content?.[0]?.text || "MCP tool returned an error";
6775
+ logger15.error(
6776
+ { toolName, toolCallId, errorMessage, rawResult },
6777
+ "MCP tool returned error status"
6778
+ );
6779
+ toolSessionManager.recordToolResult(sessionId, {
6780
+ toolCallId,
6781
+ toolName,
6782
+ args,
6783
+ result: { error: errorMessage, failed: true },
6784
+ timestamp: Date.now()
6785
+ });
6786
+ if (streamRequestId) {
6787
+ agentSessionManager.recordEvent(streamRequestId, "error", this.config.id, {
6788
+ message: `MCP tool "${toolName}" failed: ${errorMessage}`,
6789
+ code: "mcp_tool_error",
6790
+ severity: "error",
6791
+ context: {
6792
+ toolName,
6793
+ toolCallId,
6794
+ errorMessage
6795
+ }
6796
+ });
6797
+ }
6798
+ const activeSpan = trace.getActiveSpan();
6799
+ if (activeSpan) {
6800
+ const error = new Error(
6801
+ `Tool "${toolName}" failed: ${errorMessage}. This tool is currently unavailable. Please try a different approach or inform the user of the issue.`
6802
+ );
6803
+ activeSpan.recordException(error);
6804
+ activeSpan.setStatus({
6805
+ code: SpanStatusCode.ERROR,
6806
+ message: `MCP tool returned error: ${errorMessage}`
6807
+ });
6808
+ }
6809
+ throw new Error(
6810
+ `Tool "${toolName}" failed: ${errorMessage}. This tool is currently unavailable. Please try a different approach or inform the user of the issue.`
6811
+ );
6812
+ }
6773
6813
  const parsedResult = parseEmbeddedJson(rawResult);
6774
6814
  const enhancedResult = this.enhanceToolResultWithStructureHints(parsedResult);
6775
6815
  toolSessionManager.recordToolResult(sessionId, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-run-api",
3
- "version": "0.22.5",
3
+ "version": "0.22.7",
4
4
  "description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "traverse": "^0.6.11",
53
53
  "ts-pattern": "^5.7.1",
54
54
  "zod": "^4.1.11",
55
- "@inkeep/agents-core": "^0.22.5"
55
+ "@inkeep/agents-core": "^0.22.7"
56
56
  },
57
57
  "optionalDependencies": {
58
58
  "keytar": "^7.9.0"