From cee2a6f5c2062ed8042c5c4fb3244981ac84419d Mon Sep 17 00:00:00 2001 From: PratikDhanave Date: Fri, 24 Jul 2026 06:59:33 +0530 Subject: [PATCH 1/2] Add godoc to mcptool AddTool/Connect/ListTools and fix agent.Tool references Document the three exported functions in tool/mcptool, which previously printed as bare signatures under go doc. Also correct stale references to a non-existent agent.Tool type (package doc, an inline comment, and the mcpWrapper struct comment); the package exposes MCP tools as tool.Tool and registers tool.FuncTool, matching the tool package it actually uses. --- tool/mcptool/mcp.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tool/mcptool/mcp.go b/tool/mcptool/mcp.go index 28ebd695..c25e7e41 100644 --- a/tool/mcptool/mcp.go +++ b/tool/mcptool/mcp.go @@ -2,7 +2,7 @@ // Package mcp provides integration with the Model Context Protocol (MCP). // It allows agents to connect to external MCP servers via stdio, HTTP, or WebSocket -// and expose their tools and prompts as agent.Tool instances. +// and expose their tools and prompts as tool.Tool instances. package mcptool import ( @@ -18,6 +18,7 @@ import ( "github.com/modelcontextprotocol/go-sdk/mcp" ) +// AddTool registers a tool.FuncTool on the given mcp.Server so it is exposed to MCP clients. func AddTool(src *mcp.Server, tl tool.FuncTool) { src.AddTool(&mcp.Tool{ Name: tl.Name(), @@ -35,6 +36,7 @@ func AddTool(src *mcp.Server, tl tool.FuncTool) { }) } +// Connect dials an MCP server over the given transport and returns a client session. func Connect(ctx context.Context, transport mcp.Transport) (*mcp.ClientSession, error) { client := mcp.NewClient(&mcp.Implementation{ Name: "agent-framework-go-mcp-client", @@ -43,13 +45,14 @@ func Connect(ctx context.Context, transport mcp.Transport) (*mcp.ClientSession, return client.Connect(ctx, transport, nil) } +// ListTools enumerates the remote server's tools and wraps each as a tool.Tool. func ListTools(ctx context.Context, session *mcp.ClientSession) ([]tool.Tool, error) { toolsResult, err := session.ListTools(ctx, nil) if err != nil { return nil, fmt.Errorf("failed to list tools: %w", err) } - // Create agent.Tool instances for each MCP tool + // Create tool.Tool instances for each MCP tool result := make([]tool.Tool, 0, len(toolsResult.Tools)) for _, mcpTool := range toolsResult.Tools { agentTool := newMCPToolWrapper(session, mcpTool) @@ -389,7 +392,7 @@ var ( _ tool.FuncTool = (*mcpWrapper)(nil) ) -// mcpWrapper wraps an MCP tool as an agent.Tool. +// mcpWrapper wraps an MCP tool as a tool.Tool. type mcpWrapper struct { session *mcp.ClientSession tool *mcp.Tool From f3e01d2e43e5b8ac247a187f7f4cc1ae6cc3611c Mon Sep 17 00:00:00 2001 From: PratikDhanave Date: Fri, 24 Jul 2026 10:33:07 +0530 Subject: [PATCH 2/2] docs: fix mcptool package godoc name and tool-only scope --- tool/mcptool/mcp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tool/mcptool/mcp.go b/tool/mcptool/mcp.go index c25e7e41..d0b3421c 100644 --- a/tool/mcptool/mcp.go +++ b/tool/mcptool/mcp.go @@ -1,8 +1,8 @@ // Copyright (c) Microsoft. All rights reserved. -// Package mcp provides integration with the Model Context Protocol (MCP). +// Package mcptool provides integration with the Model Context Protocol (MCP). // It allows agents to connect to external MCP servers via stdio, HTTP, or WebSocket -// and expose their tools and prompts as tool.Tool instances. +// and expose their tools as tool.Tool instances. package mcptool import (