Skip to content

refactor(mcp): remove redundant entry-level logs and cross-reference list* methods#7384

Merged
lpcox merged 2 commits into
mainfrom
copilot/duplicate-code-list-tools-resources-prompts
Jun 11, 2026
Merged

refactor(mcp): remove redundant entry-level logs and cross-reference list* methods#7384
lpcox merged 2 commits into
mainfrom
copilot/duplicate-code-list-tools-resources-prompts

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

listTools, listResources, and listPrompts each fired a logConn.Printf entry log that duplicated the logging already emitted by listMCPItems after session validation. The three functions were also undocumented as intentionally parallel, creating a silent maintenance contract.

Changes

  • internal/mcp/connection_methods.go
    • Removed the redundant per-function logConn.Printf from listTools, listResources, and listPrompts — equivalent logging continues inside listMCPItems ("list%s: requesting %s list from backend serverID=%s")
    • Added Godoc cross-reference comments to each function documenting the intentional parallel structure:
// listTools fetches all tools from the backend via paginated SDK calls.
// See also: listResources, listPrompts — these three follow the same structure.
func (c *Connection) listTools() (*Response, error) {
    return listSDKItems(c, "tools", ...)
}

GitHub Advanced Security started work on behalf of lpcox June 11, 2026 18:02 View session
GitHub Advanced Security finished work on behalf of lpcox June 11, 2026 18:03
… to list* methods

The listTools, listResources, and listPrompts functions each had a
per-function log statement that duplicated the logging already performed
inside listMCPItems (in pagination.go). Remove the redundant log calls
and add Godoc cross-reference comments to document the intentional
parallel structure of the three functions.

Closes #7361
Copilot AI changed the title [WIP] Refactor duplicate code in listTools, listResources, and listPrompts refactor(mcp): remove redundant entry-level logs and cross-reference list* methods Jun 11, 2026
Copilot finished work on behalf of lpcox June 11, 2026 18:07
Copilot AI requested a review from lpcox June 11, 2026 18:07
GitHub Advanced Security started work on behalf of lpcox June 11, 2026 18:12 View session
@lpcox lpcox marked this pull request as ready for review June 11, 2026 18:14
Copilot AI review requested due to automatic review settings June 11, 2026 18:14
GitHub Advanced Security finished work on behalf of lpcox June 11, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors MCP connection list operations to reduce redundant logging and clarify intentional parallel structure among the list* methods that fetch paginated data via the SDK.

Changes:

  • Removed per-function entry logs from listTools, listResources, and listPrompts, relying on the centralized logging in listMCPItems after session validation.
  • Added GoDoc cross-reference comments documenting that listTools, listResources, and listPrompts intentionally share the same structure.
Show a summary per file
File Description
internal/mcp/connection_methods.go Removes redundant list-entry logs and adds GoDoc “See also” cross-references for the parallel list methods.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@lpcox lpcox merged commit a1aeaa7 into main Jun 11, 2026
40 checks passed
@lpcox lpcox deleted the copilot/duplicate-code-list-tools-resources-prompts branch June 11, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants