feat: add MCP tools registration to LLM service

- Add RegisterTools method to ILLMService interface
- Create shared MCP to eino tool converter
- Auto-register built-in uixt tools in XTDriver initialization
- Refactor MCPHost to use shared converter
- Add comprehensive test coverage for tool conversion

This enables doubao-1.5-thinking-vision-pro model to access
MCP tools through function calling mechanism.
This commit is contained in:
lilong.129
2025-06-09 22:19:43 +08:00
parent dd52faef57
commit 39acadb0a7
8 changed files with 221 additions and 24 deletions
+12
View File
@@ -3,6 +3,7 @@ package ai
import (
"context"
"github.com/cloudwego/eino/schema"
"github.com/httprunner/httprunner/v5/uixt/option"
)
@@ -10,6 +11,8 @@ import (
type ILLMService interface {
Call(ctx context.Context, opts *PlanningOptions) (*PlanningResult, error)
Assert(ctx context.Context, opts *AssertOptions) (*AssertionResult, error)
// RegisterTools registers tools for function calling
RegisterTools(tools []*schema.ToolInfo) error
}
func NewLLMService(modelType option.LLMServiceType) (ILLMService, error) {
@@ -49,3 +52,12 @@ func (c *combinedLLMService) Call(ctx context.Context, opts *PlanningOptions) (*
func (c *combinedLLMService) Assert(ctx context.Context, opts *AssertOptions) (*AssertionResult, error) {
return c.asserter.Assert(ctx, opts)
}
// RegisterTools registers tools for function calling
func (c *combinedLLMService) RegisterTools(tools []*schema.ToolInfo) error {
// Only register tools to planner since asserter doesn't need tools
if planner, ok := c.planner.(*Planner); ok {
return planner.RegisterTools(tools)
}
return nil
}