mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-13 00:11:28 +08:00
feat: optimize MCP tools response format with automatic schema generation
- Remove all manual ReturnSchema() methods from tools - Implement automatic schema generation using reflection - Unify response format to flat structure with action/success/message fields - Simplify tool implementation by removing MCPResponse embedding - Update documentation to reflect new architecture - Achieve ~70% code reduction while maintaining type safety
This commit is contained in:
@@ -161,7 +161,7 @@ func (host *MCPHost) convertSingleToolToRecord(serverName string, tool mcp.Tool,
|
||||
return MCPToolRecord{
|
||||
ToolID: id,
|
||||
VisibleRange: 1,
|
||||
ToolType: "edge",
|
||||
ToolType: "Hrp",
|
||||
ServerName: serverName,
|
||||
ToolName: tool.Name,
|
||||
Description: info.Description,
|
||||
@@ -227,7 +227,7 @@ func (host *MCPHost) extractReturns(serverName, toolName string, info DocStringI
|
||||
// Priority 1: Get from ActionTool interface if available
|
||||
if actionToolProvider := host.getActionToolProvider(serverName); actionToolProvider != nil {
|
||||
if actionTool := actionToolProvider.GetToolByAction(option.ActionName(toolName)); actionTool != nil {
|
||||
returnSchema := actionTool.ReturnSchema()
|
||||
returnSchema := uixt.GenerateReturnSchema(actionTool)
|
||||
if len(returnSchema) > 0 {
|
||||
return host.marshalToJSON(returnSchema, "return schema")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user