This commit is contained in:
Timothy Jaeryang Baek committed 2026-05-09 06:50:11 +09:00
1 parent 02f9fe7890
commit 2ba6b423aa
3 files changed
+10 -3

No files matched your search

+4
View File
@@ -814,6 +814,8 @@ def convert_openapi_to_tool_payload(openapi_spec):
for path, methods in openapi_spec.get('paths', {}).items(): for path, methods in openapi_spec.get('paths', {}).items():
for method, operation in methods.items(): for method, operation in methods.items():
if not isinstance(operation, dict):
continue
if operation.get('operationId'): if operation.get('operationId'):
tool = { tool = {
'name': operation.get('operationId'), 'name': operation.get('operationId'),
@@ -1324,6 +1326,8 @@ async def execute_tool_server(
method_entry = None method_entry = None
for http_method, operation in methods.items(): for http_method, operation in methods.items():
if not isinstance(operation, dict):
continue
if operation.get('operationId') == name: if operation.get('operationId') == name:
method_entry = (http_method.lower(), operation) method_entry = (http_method.lower(), operation)
break break
+4 -2
View File
@@ -530,7 +530,9 @@ export const executeToolServer = async (
try { try {
// Find the matching operationId in the OpenAPI spec // Find the matching operationId in the OpenAPI spec
const matchingRoute = Object.entries(serverData.openapi.paths).find(([_, methods]) => const matchingRoute = Object.entries(serverData.openapi.paths).find(([_, methods]) =>
Object.entries(methods as any).some(([__, operation]: any) => operation.operationId === name) Object.entries(methods as any).some(
([__, operation]: any) => operation && typeof operation === 'object' && operation.operationId === name
)
); );
if (!matchingRoute) { if (!matchingRoute) {
@@ -540,7 +542,7 @@ export const executeToolServer = async (
const [routePath, methods] = matchingRoute; const [routePath, methods] = matchingRoute;
const methodEntry = Object.entries(methods as any).find( const methodEntry = Object.entries(methods as any).find(
([_, operation]: any) => operation.operationId === name ([_, operation]: any) => operation && typeof operation === 'object' && operation.operationId === name
); );
if (!methodEntry) { if (!methodEntry) {
+2 -1
View File
@@ -1395,7 +1395,8 @@ export const convertOpenApiToToolPayload = (openApiSpec) => {
for (const [path, methods] of Object.entries(openApiSpec.paths)) { for (const [path, methods] of Object.entries(openApiSpec.paths)) {
for (const [method, operation] of Object.entries(methods)) { for (const [method, operation] of Object.entries(methods)) {
if (operation?.operationId) { if (!operation || typeof operation !== 'object') continue;
if ((operation as any)?.operationId) {
const tool = { const tool = {
name: operation.operationId, name: operation.operationId,
description: operation.description || operation.summary || 'No description available.', description: operation.description || operation.summary || 'No description available.',