Add godoc to mcptool AddTool/Connect/ListTools and fix agent.Tool references to tool.Tool - #685
Add godoc to mcptool AddTool/Connect/ListTools and fix agent.Tool references to tool.Tool#685PratikDhanave wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Improves the public Go API documentation for the tool/mcptool package by adding missing godoc for exported entry points and correcting stale type references so that go doc reflects the actual tool.Tool / tool.FuncTool types used by the integration.
Changes:
- Add one-line godoc comments for the exported
AddTool,Connect, andListToolsfunctions. - Replace stale
agent.Toolreferences in comments withtool.Toolto match the real exported types. - Update inline documentation around the MCP tool wrapper to reflect
tool.Tool.
Comments suppressed due to low confidence (1)
tool/mcptool/mcp.go:60
- In
ListTools, the local variable nameagentToolis now misleading since this package returnstool.Toolvalues (and the surrounding comment has been updated accordingly). Renaming it would improve readability and align terminology with the corrected docs.
for _, mcpTool := range toolsResult.Tools {
agentTool := newMCPToolWrapper(session, mcpTool)
result = append(result, agentTool)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 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. |
There was a problem hiding this comment.
Good catch — fixed in 5b08887: renamed the godoc opener to Package mcptool to match the package name, and dropped the "and prompts" claim since only tools are exposed here.
This comment has been minimized.
This comment has been minimized.
a1ed678 to
8a6a2fe
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…erences 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.
5b08887 to
f3e01d2
Compare
Parity Review: ✅ No issues foundThis PR makes documentation-only changes to
No exported Go API surface was added, removed, or changed. Behavior and signatures are identical to the pre-PR state. Cross-repo parity: The .NET and Python MCP integrations already document their public connect/list/register entry points. This change brings the Go documentation into alignment with that practice — a net parity improvement with no divergence introduced. Labels: The Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
What
tool/mcptool/mcp.go:AddTool,Connect, andListTools. They previously printed as bare signatures undergo doc.agent.Tooltype (the package doc, an inline comment, and themcpWrapperstruct comment). There is noagent.Tool; the package actually exposes MCP tools astool.Tool(ListToolsreturns[]tool.Tool) and registerstool.FuncTool.Why
The .NET and Python MCP integrations document their public connect/list/register entry points; leaving these Go equivalents undocumented and pointing at a type that does not exist is a cross-SDK parity and correctness gap for anyone browsing the API. The wording now names the types that are genuinely in play (
tool.Tool,tool.FuncTool).Testing
Docs-only change.
go build ./...passes.go vet ./tool/mcptool/...passes.go test ./tool/mcptool/...passes.go doc ./tool/mcptoolnow shows the descriptions.grep -n 'agent.Tool' tool/mcptool/mcp.goreturns nothing.