Skip to content

Commit 5ae2a33

Browse files
fix(mcp): return tool execution error on api error
1 parent 73a6ad5 commit 5ae2a33

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

packages/mcp-server/src/tools/classifications/universal/create-classifications-universal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const handler = async (client: Isaacus, args: Record<string, unknown> | u
9494
await maybeFilter(jq_filter, await client.classifications.universal.create(body)),
9595
);
9696
} catch (error) {
97-
if (isJqError(error)) {
97+
if (error instanceof Isaacus.APIError || isJqError(error)) {
9898
return asErrorResult(error.message);
9999
}
100100
throw error;

packages/mcp-server/src/tools/embeddings/create-embeddings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const handler = async (client: Isaacus, args: Record<string, unknown> | u
7878
try {
7979
return asTextContentResult(await maybeFilter(jq_filter, await client.embeddings.create(body)));
8080
} catch (error) {
81-
if (isJqError(error)) {
81+
if (error instanceof Isaacus.APIError || isJqError(error)) {
8282
return asErrorResult(error.message);
8383
}
8484
throw error;

packages/mcp-server/src/tools/extractions/qa/create-extractions-qa.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const handler = async (client: Isaacus, args: Record<string, unknown> | u
9191
try {
9292
return asTextContentResult(await maybeFilter(jq_filter, await client.extractions.qa.create(body)));
9393
} catch (error) {
94-
if (isJqError(error)) {
94+
if (error instanceof Isaacus.APIError || isJqError(error)) {
9595
return asErrorResult(error.message);
9696
}
9797
throw error;

packages/mcp-server/src/tools/rerankings/create-rerankings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const handler = async (client: Isaacus, args: Record<string, unknown> | u
9696
try {
9797
return asTextContentResult(await maybeFilter(jq_filter, await client.rerankings.create(body)));
9898
} catch (error) {
99-
if (isJqError(error)) {
99+
if (error instanceof Isaacus.APIError || isJqError(error)) {
100100
return asErrorResult(error.message);
101101
}
102102
throw error;

0 commit comments

Comments
 (0)