mcpTool

package
v0.0.0-...-39abc7b Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAllTools

func RegisterAllTools(mcpServer *server.MCPServer)

RegisterAllTools 将所有注册的工具注册到MCP服务中

func RegisterTool

func RegisterTool(tool McpTool)

RegisterTool 供工具在init时调用,将自己注册到工具注册表中

Types

type CurrentTime

type CurrentTime struct {
}

func (*CurrentTime) Handle

func (t *CurrentTime) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

获取当前系统时间

func (*CurrentTime) New

func (t *CurrentTime) New() mcp.Tool

type GetNickname

type GetNickname struct{}

func (*GetNickname) Handle

func (t *GetNickname) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)

Handle 处理获取昵称的请求

func (*GetNickname) New

func (t *GetNickname) New() mcp.Tool

根据用户username获取nickname

type McpTool

type McpTool interface {
	// Handle 返回工具调用信息
	Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)
	// New 返回工具注册信息
	New() mcp.Tool
}

McpTool 定义了MCP工具必须实现的接口

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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