tools

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertMCPToolsToOpenAITools

func ConvertMCPToolsToOpenAITools(tools *mcp.ListToolsResult) []openai.ChatCompletionToolUnionParam

ConvertMCPToolsToOpenAITools transforms MCP tool definitions into OpenAI tool format

func ConvertMCPToolsToOpenAIToolsWithFilter added in v0.0.1

func ConvertMCPToolsToOpenAIToolsWithFilter(tools *mcp.ListToolsResult, toolsFilter []string) []openai.ChatCompletionToolUnionParam

ConvertMCPToolsToOpenAIToolsWithFilter transforms filtered MCP tool definitions into OpenAI tool format

Types

type MCPClient

type MCPClient struct {
	ToolsResult *mcp.ListToolsResult
	// contains filtered or unexported fields
}

MCPClient wraps an MCP client connection with available tools

func NewStreamableHttpMCPClient

func NewStreamableHttpMCPClient(ctx context.Context, mcpHostURL string) (*MCPClient, error)

NewStreamableHttpMCPClient creates and initializes a new MCP client over HTTP

func (*MCPClient) CallTool

func (c *MCPClient) CallTool(ctx context.Context, functionName string, arguments string) (*mcp.CallToolResult, error)

CallTool executes a tool call with the given function name and JSON arguments

func (*MCPClient) Close

func (c *MCPClient) Close() error

Close safely closes the MCP client connection

func (*MCPClient) OpenAITools

func (c *MCPClient) OpenAITools() []openai.ChatCompletionToolUnionParam

OpenAITools converts the MCP client's tools to OpenAI-compatible format

func (*MCPClient) OpenAIToolsWithFilter added in v0.0.1

func (c *MCPClient) OpenAIToolsWithFilter(toolsFilter []string) []openai.ChatCompletionToolUnionParam

OpenAIToolsWithFilter converts only the filtered MCP tools to OpenAI-compatible format

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL