docs: update docs

This commit is contained in:
lilong.129
2025-05-17 12:03:30 +08:00
parent e94dacb5b2
commit e35d644acf
28 changed files with 45 additions and 46 deletions

View File

@@ -54,11 +54,11 @@ Copyright © 2017-present debugtalk. Apache-2.0 License.
* [hrp build](hrp_build.md) - Build plugin for testing
* [hrp convert](hrp_convert.md) - Convert multiple source format to HttpRunner JSON/YAML/gotest/pytest cases
* [hrp ios](hrp_ios.md) - simple utils for ios device management
* [hrp mcphost](hrp_mcphost.md) - Export MCP server tools to JSON description
* [hrp mcphost](hrp_mcphost.md) - Start a chat session to interact with MCP tools
* [hrp pytest](hrp_pytest.md) - Run API test with pytest
* [hrp run](hrp_run.md) - Run API test with go engine
* [hrp server](hrp_server.md) - Start hrp server
* [hrp startproject](hrp_startproject.md) - Create a scaffold project
* [hrp wiki](hrp_wiki.md) - visit https://httprunner.com
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -23,4 +23,4 @@ simple utils for android device management
* [hrp adb install](hrp_adb_install.md) - push package to the device and install them automatically
* [hrp adb screencap](hrp_adb_screencap.md) - Start android screen capture
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -24,4 +24,4 @@ hrp adb devices [flags]
* [hrp adb](hrp_adb.md) - simple utils for android device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -28,4 +28,4 @@ hrp adb install [flags] PACKAGE
* [hrp adb](hrp_adb.md) - simple utils for android device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -25,4 +25,4 @@ hrp adb screencap [flags]
* [hrp adb](hrp_adb.md) - simple utils for android device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -36,4 +36,4 @@ hrp build $path ... [flags]
* [hrp](hrp.md) - All-in-One Testing Framework for API, UI and Performance
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -34,4 +34,4 @@ hrp convert $path... [flags]
* [hrp](hrp.md) - All-in-One Testing Framework for API, UI and Performance
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -29,4 +29,4 @@ simple utils for ios device management
* [hrp ios uninstall](hrp_ios_uninstall.md) - uninstall package automatically
* [hrp ios xctest](hrp_ios_xctest.md) - run xctest
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -26,4 +26,4 @@ hrp ios apps [flags]
* [hrp ios](hrp_ios.md) - simple utils for ios device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -24,4 +24,4 @@ hrp ios devices [flags]
* [hrp ios](hrp_ios.md) - simple utils for ios device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -25,4 +25,4 @@ hrp ios install [flags] PACKAGE
* [hrp ios](hrp_ios.md) - simple utils for ios device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -28,4 +28,4 @@ hrp ios mount [flags]
* [hrp ios](hrp_ios.md) - simple utils for ios device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -26,4 +26,4 @@ hrp ios ps [flags]
* [hrp ios](hrp_ios.md) - simple utils for ios device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -25,4 +25,4 @@ hrp ios reboot [flags]
* [hrp ios](hrp_ios.md) - simple utils for ios device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -24,4 +24,4 @@ hrp ios tunnel [flags]
* [hrp ios](hrp_ios.md) - simple utils for ios device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -26,4 +26,4 @@ hrp ios uninstall [flags] PACKAGE
* [hrp ios](hrp_ios.md) - simple utils for ios device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -28,4 +28,4 @@ hrp ios xctest [flags]
* [hrp ios](hrp_ios.md) - simple utils for ios device management
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -1,11 +1,10 @@
## hrp mcphost
Export MCP server tools to JSON description
Start a chat session to interact with MCP tools
### Synopsis
Export all tools from MCP servers to JSON description.
The tools will be exported with their descriptions, parameters, and return values.
mcphost is a command-line tool that allows you to interact with MCP tools.
```
hrp mcphost [flags]
@@ -14,9 +13,10 @@ hrp mcphost [flags]
### Options
```
--dump string path to save the exported tools JSON file (default "tools_records.json")
-h, --help help for mcphost
-c, --mcp-config string path to the MCP config file (default "$HOME/.hrp/mcp.json")
--dump string path to save the exported tools JSON file
-h, --help help for mcphost
-c, --mcp-config string path to the MCP config file (default "$HOME/.hrp/mcp.json")
--system-prompt string path to system prompt JSON file
```
### Options inherited from parent commands
@@ -31,4 +31,4 @@ hrp mcphost [flags]
* [hrp](hrp.md) - All-in-One Testing Framework for API, UI and Performance
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -24,4 +24,4 @@ hrp pytest $path ... [flags]
* [hrp](hrp.md) - All-in-One Testing Framework for API, UI and Performance
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -44,4 +44,4 @@ hrp run $path... [flags]
* [hrp](hrp.md) - All-in-One Testing Framework for API, UI and Performance
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -30,4 +30,4 @@ hrp server start [flags]
* [hrp](hrp.md) - All-in-One Testing Framework for API, UI and Performance
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -29,4 +29,4 @@ hrp startproject $project_name [flags]
* [hrp](hrp.md) - All-in-One Testing Framework for API, UI and Performance
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -24,4 +24,4 @@ hrp wiki [flags]
* [hrp](hrp.md) - All-in-One Testing Framework for API, UI and Performance
###### Auto generated by spf13/cobra on 16-May-2025
###### Auto generated by spf13/cobra on 17-May-2025

View File

@@ -1 +1 @@
v5.0.0-beta-2505171155
v5.0.0-beta-2505171220

View File

@@ -36,15 +36,6 @@ func (h *MCPHost) NewChat(ctx context.Context, systemPromptFile string) (*Chat,
return nil, errors.Wrap(code.LLMPrepareRequestError, err.Error())
}
// Create markdown renderer
renderer, err := glamour.NewTermRenderer(
glamour.WithStandardStyle(styles.TokyoNightStyle),
glamour.WithWordWrap(getTerminalWidth()),
)
if err != nil {
return nil, errors.Wrap(err, "failed to create markdown renderer")
}
// Load system prompt from file if provided
systemPrompt := "chat to interact with MCP tools"
if systemPromptFile != "" {
@@ -57,17 +48,25 @@ func (h *MCPHost) NewChat(ctx context.Context, systemPromptFile string) (*Chat,
}
}
// convert MCP tools to eino tool infos
// Convert MCP tools to eino tool infos
einoTools, err := h.GetEinoToolInfos(ctx)
if err != nil {
return nil, errors.Wrap(err, "failed to get eino tool infos")
}
toolCallingModel, err := model.WithTools(einoTools)
if err != nil {
return nil, errors.Wrap(code.LLMPrepareRequestError, err.Error())
}
// Create markdown renderer
renderer, err := glamour.NewTermRenderer(
glamour.WithStandardStyle(styles.TokyoNightStyle),
glamour.WithWordWrap(getTerminalWidth()),
)
if err != nil {
return nil, errors.Wrap(err, "failed to create markdown renderer")
}
return &Chat{
model: toolCallingModel,
systemPrompt: systemPrompt,

View File

@@ -11,7 +11,7 @@ import (
func TestNewChat(t *testing.T) {
systemPromptFile := "test_system_prompt.txt"
_ = os.WriteFile(systemPromptFile, []byte("You are a helpful assistant."), 0o644)
_ = os.WriteFile(systemPromptFile, []byte("You are a helpful assistant."), 0o600)
defer os.Remove(systemPromptFile)
host, err := NewMCPHost("./testdata/test.mcp.json")

View File

@@ -122,7 +122,7 @@ func ConvertToolsToRecords(tools []MCPTools) []MCPToolRecord {
for _, tool := range mcpTools.Tools {
// Generate unique ID by combining server name and tool name
id := fmt.Sprintf("%s_%s", mcpTools.ServerName, tool.Name)
id := fmt.Sprintf("%s__%s", mcpTools.ServerName, tool.Name)
// Extract docstring information
info := extractDocStringInfo(tool.Description)
@@ -172,7 +172,7 @@ func (h *MCPHost) ExportToolsToJSON(ctx context.Context, dumpPath string) error
// create output directory
outputDir := filepath.Dir(dumpPath)
if outputDir != "." {
if err := os.MkdirAll(outputDir, 0o755); err != nil {
if err := os.MkdirAll(outputDir, 0o754); err != nil {
return fmt.Errorf("failed to create output directory: %w", err)
}
}

View File

@@ -14,7 +14,7 @@ type ToolRequest struct {
func (r *Router) invokeToolHandler(c *gin.Context) {
if r.mcpHost == nil {
RenderError(c, errors.New("mcp host not initialized"))
RenderError(c, errors.New("mcphost not initialized"))
return
}