mirror of
https://github.com/samanhappy/mcphub.git
synced 2025-12-23 18:29:21 -05:00
Optimizing API Operations: Simplified operationId Values and Large String Parameter Management (#488)
This commit is contained in:
@@ -42,7 +42,7 @@ function convertToolSchemaToOpenAPI(tool: Tool): {
|
|||||||
(prop: any) =>
|
(prop: any) =>
|
||||||
prop.type === 'object' ||
|
prop.type === 'object' ||
|
||||||
prop.type === 'array' ||
|
prop.type === 'array' ||
|
||||||
(prop.type === 'string' && prop.enum && prop.enum.length > 10),
|
prop.type === 'string',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!hasComplexTypes && Object.keys(properties).length <= 10) {
|
if (!hasComplexTypes && Object.keys(properties).length <= 10) {
|
||||||
@@ -93,7 +93,7 @@ function generateOperationFromTool(tool: Tool, serverName: string): OpenAPIV3.Op
|
|||||||
const operation: OpenAPIV3.OperationObject = {
|
const operation: OpenAPIV3.OperationObject = {
|
||||||
summary: tool.description || `Execute ${tool.name} tool`,
|
summary: tool.description || `Execute ${tool.name} tool`,
|
||||||
description: tool.description || `Execute the ${tool.name} tool from ${serverName} server`,
|
description: tool.description || `Execute the ${tool.name} tool from ${serverName} server`,
|
||||||
operationId: `${serverName}_${tool.name}`,
|
operationId: `${tool.name}`,
|
||||||
tags: [serverName],
|
tags: [serverName],
|
||||||
...(parameters && parameters.length > 0 && { parameters }),
|
...(parameters && parameters.length > 0 && { parameters }),
|
||||||
...(requestBody && { requestBody }),
|
...(requestBody && { requestBody }),
|
||||||
|
|||||||
Reference in New Issue
Block a user