Skip to content

Remove unused NewMCPInspectCommand function#3767

Merged
pelikhan merged 2 commits into
mainfrom
copilot/remove-unused-newmcpinspectcommand
Nov 13, 2025
Merged

Remove unused NewMCPInspectCommand function#3767
pelikhan merged 2 commits into
mainfrom
copilot/remove-unused-newmcpinspectcommand

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 12, 2025

The file pkg/cli/mcp_inspect.go contained duplicate command constructors from a refactoring where the MCP inspect command was moved from top-level to a subcommand.

Changes

  • Removed NewMCPInspectCommand() (66 lines) - never referenced in codebase
  • Retained NewMCPInspectSubcommand() - active implementation used in pkg/cli/mcp.go:32

Both functions were functionally identical with the same flags, descriptions, and examples. The unused function was leftover dead code from the command hierarchy restructuring.

// Before: Two nearly identical functions existed
func NewMCPInspectCommand() *cobra.Command { ... }        // ❌ Never called
func NewMCPInspectSubcommand() *cobra.Command { ... }     // ✅ Active

// After: Only the active subcommand remains
func NewMCPInspectSubcommand() *cobra.Command { ... }     // ✅ Active

File reduction: 601 → 535 lines (11% decrease)

Original prompt

This section details on the original issue you should resolve

<issue_title>[cli-consistency] Dead code: Unused NewMCPInspectCommand function in mcp_inspect.go</issue_title>
<issue_description>## Issue Description

File: pkg/cli/mcp_inspect.go
Type: Dead code / Code cleanup
Priority: Low

Current Situation

The file pkg/cli/mcp_inspect.go contains two nearly identical functions for creating the MCP inspect command:

  1. NewMCPInspectCommand() at line 257 - Never used
  2. NewMCPInspectSubcommand() at line 532 - Actually used (referenced in pkg/cli/mcp.go:32)

Evidence

From pkg/cli/mcp.go:

cmd.AddCommand(NewMCPInspectSubcommand())  // Line 32 - This is the one actually used

The NewMCPInspectCommand() function is defined at line 257 but is never referenced anywhere in the codebase.

Impact

  • Low impact: The unused function doesn't affect functionality
  • Code maintenance: Having duplicate functions is confusing for developers
  • Binary size: Unused code slightly increases the binary size
  • Code clarity: Reduces codebase clarity

Suggested Fix

Remove the NewMCPInspectCommand() function (lines 257-320) since it's not being used. Keep only NewMCPInspectSubcommand() which is the active implementation.

Additional Context

Both functions have identical:

  • Short descriptions: "Inspect MCP servers and list available tools, resources, and roots"
  • Long descriptions (same examples and documentation)
  • Flag definitions

This appears to be leftover code from a refactoring where the command was moved from a top-level command to a subcommand under the mcp command.

AI generated by CLI Consistency Checker</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove unused NewMCPInspectCommand function Remove unused NewMCPInspectCommand function Nov 12, 2025
Copilot AI requested a review from pelikhan November 12, 2025 23:54
@pelikhan pelikhan marked this pull request as ready for review November 12, 2025 23:56
Copilot AI review requested due to automatic review settings November 12, 2025 23:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 removes dead code from the MCP inspect command implementation. The NewMCPInspectCommand() function was a leftover artifact from when the command was restructured from a top-level command into a subcommand under mcp. The removal is safe and improves code maintainability.

Key changes:

  • Removed the unused NewMCPInspectCommand() function (66 lines)
  • Retained NewMCPInspectSubcommand() which is actively used in the command hierarchy
  • Reduced file size by 11% (601 → 535 lines)

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

@pelikhan pelikhan merged commit 0e9e9cb into main Nov 13, 2025
99 checks passed
@pelikhan pelikhan deleted the copilot/remove-unused-newmcpinspectcommand branch November 13, 2025 00:15
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.

[cli-consistency] Dead code: Unused NewMCPInspectCommand function in mcp_inspect.go

3 participants