refactor: enhance MCP tool management with risk policies and confirmation handling

This commit is contained in:
mlogclub
2026-07-28 11:33:15 +08:00
parent ed109047d3
commit 07370fe9a2
17 changed files with 448 additions and 117 deletions
@@ -23,7 +23,11 @@ func (p *systemToolProvider) Register(server *mcp.Server) error {
server,
&mcp.Tool{
Name: "server_time",
Title: "获取当前时间",
Description: "获取当前服务端时间,可选传入时区。",
Annotations: &mcp.ToolAnnotations{
ReadOnlyHint: true,
},
},
func(_ context.Context, _ *mcp.CallToolRequest, args serverTimeArgs) (*mcp.CallToolResult, map[string]any, error) {
loc := time.Local
@@ -46,7 +50,11 @@ func (p *systemToolProvider) Register(server *mcp.Server) error {
server,
&mcp.Tool{
Name: "service_info",
Title: "查看服务信息",
Description: "查看当前 agent-desk 服务的基础运行信息。",
Annotations: &mcp.ToolAnnotations{
ReadOnlyHint: true,
},
},
func(ctx context.Context, req *mcp.CallToolRequest, _ struct{}) (*mcp.CallToolResult, map[string]any, error) {
cfg := config.Current()