From 5f9679253e7433340a5bd20b4e7ed916fef7f25c Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 27 Mar 2025 23:59:16 -0700 Subject: [PATCH] refac: openapi tool server support --- src/lib/apis/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/apis/index.ts b/src/lib/apis/index.ts index 93a3459d0..807fcf1db 100644 --- a/src/lib/apis/index.ts +++ b/src/lib/apis/index.ts @@ -386,9 +386,9 @@ export const executeToolServer = async ( // Handle requestBody composite if (operation.requestBody && operation.requestBody.content) { - const contentType = Object.keys(operation.requestBody.content)[0]; // typically "application/json" - if (params.body !== undefined) { - bodyParams = params.body; // Assume the provided params has a "body" property containing the payload + const contentType = Object.keys(operation.requestBody.content)[0]; + if (params !== undefined) { + bodyParams = params; } else { // Optional: Fallback or explicit error if body is expected but not provided throw new Error(`Request body expected for operation '${name}' but none found.`);