Skip to content

Commit 03955a8

Browse files
committed
remove search --detailed
1 parent 987937f commit 03955a8

File tree

2 files changed

+16
-106
lines changed

2 files changed

+16
-106
lines changed

src/mcpm/commands/search.py

Lines changed: 3 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,20 @@
1414

1515
@click.command()
1616
@click.argument("query", required=False)
17-
@click.option("--detailed", is_flag=True, help="Show detailed server information")
1817
@click.option("--table", is_flag=True, help="Display results in table format with descriptions")
1918
@click.help_option("-h", "--help")
20-
def search(query, detailed=False, table=False):
19+
def search(query, table=False):
2120
"""Search available MCP servers.
2221
2322
Searches the MCP registry for available servers. Without arguments, lists all available servers.
24-
By default, only shows server names. Use --table for more details or --detailed for full information.
23+
By default, only shows server names. Use --table for more details.
2524
2625
Examples:
2726
2827
\b
2928
mcpm search # List all available servers (names only)
3029
mcpm search github # Search for github server
3130
mcpm search --table # Show results in a table with descriptions
32-
mcpm search --detailed # Show detailed information
3331
"""
3432
# Show appropriate search message
3533
search_criteria = []
@@ -53,9 +51,7 @@ def search(query, detailed=False, table=False):
5351
return
5452

5553
# Show different views based on detail level
56-
if detailed:
57-
_display_detailed_results(servers)
58-
elif table:
54+
if table:
5955
print_servers_table(servers)
6056
else:
6157
print_simple_servers_list(servers)
@@ -65,88 +61,3 @@ def search(query, detailed=False, table=False):
6561

6662
except Exception as e:
6763
print_error("Error searching for servers", str(e))
68-
69-
70-
def _display_detailed_results(servers):
71-
"""Display detailed information about each server"""
72-
for i, server in enumerate(sorted(servers, key=lambda s: s["name"])):
73-
# Get server data
74-
name = server["name"]
75-
display_name = server.get("display_name", name)
76-
description = server.get("description", "No description")
77-
license_info = server.get("license", "Unknown")
78-
79-
# Get author info
80-
author_info = server.get("author", {})
81-
author_name = author_info.get("name", "Unknown")
82-
author_email = author_info.get("email", "")
83-
84-
# Build categories and tags
85-
categories = server.get("categories", [])
86-
tags = server.get("tags", [])
87-
88-
# Get installation details
89-
installations = server.get("installations", {})
90-
installation = server.get("installation", {})
91-
package = installation.get("package", "")
92-
93-
# Print server header
94-
console.print(f"[bold cyan]{display_name}[/] [dim]({name})[/]")
95-
console.print(f"[italic]{description}[/]\n")
96-
97-
# Server information section
98-
console.print("[bold yellow]Server Information:[/]")
99-
if categories:
100-
console.print(f"Categories: {', '.join(categories)}")
101-
if tags:
102-
console.print(f"Tags: {', '.join(tags)}")
103-
if package:
104-
console.print(f"Package: {package}")
105-
console.print(f"Author: {author_name}" + (f" ({author_email})" if author_email else ""))
106-
console.print(f"License: {license_info}")
107-
console.print("")
108-
109-
# Installation details section
110-
if installations:
111-
console.print("[bold yellow]Installation Details:[/]")
112-
for method in installations.values():
113-
method_type = method.get("type", "unknown")
114-
description = method.get("description", f"{method_type} installation")
115-
recommended = " [green](recommended)[/]" if method.get("recommended", False) else ""
116-
117-
console.print(f"[cyan]{method_type}[/]: {description}{recommended}")
118-
119-
# Show command if available
120-
if "command" in method:
121-
cmd = method["command"]
122-
args = method.get("args", [])
123-
cmd_str = f"{cmd} {' '.join(args)}" if args else cmd
124-
console.print(f"Command: [green]{cmd_str}[/]")
125-
126-
# Show dependencies if available
127-
dependencies = method.get("dependencies", [])
128-
if dependencies:
129-
console.print("Dependencies: " + ", ".join(dependencies))
130-
131-
# Show environment variables if available
132-
env_vars = method.get("env", {})
133-
if env_vars:
134-
console.print("Environment Variables:")
135-
for key, value in env_vars.items():
136-
console.print(f' [bold blue]{key}[/] = [green]"{value}"[/]')
137-
console.print("")
138-
139-
# If there are examples, show the first one
140-
examples = server.get("examples", [])
141-
if examples:
142-
console.print("[bold yellow]Example:[/]")
143-
first_example = examples[0]
144-
if "title" in first_example:
145-
console.print(f"[bold]{first_example['title']}[/]")
146-
if "description" in first_example:
147-
console.print(f"{first_example['description']}")
148-
console.print("")
149-
150-
# Add a separator between servers (except for the last one)
151-
if i < len(servers) - 1:
152-
console.print("[dim]" + "-" * 50 + "[/]\n")

tests/test_search.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def test_search_no_results(monkeypatch):
8686
mock_repo_manager.search_servers.assert_called_once_with("nonexistent")
8787

8888

89-
def test_search_detailed_view(monkeypatch):
90-
"""Test searching with detailed view"""
89+
def test_search_table_view(monkeypatch):
90+
"""Test searching with table view"""
9191
# Mock repository manager
9292
mock_repo_manager = Mock()
9393
mock_repo_manager.search_servers = Mock(
@@ -118,16 +118,17 @@ def test_search_detailed_view(monkeypatch):
118118
)
119119
monkeypatch.setattr("mcpm.commands.search.repo_manager", mock_repo_manager)
120120

121-
# Run the command with detailed flag
121+
# Run the command with table flag
122122
runner = CliRunner()
123-
result = runner.invoke(search, ["--detailed"])
123+
result = runner.invoke(search, ["--table"])
124124

125125
assert result.exit_code == 0
126126
assert "Test Server" in result.output
127127
assert "A test server" in result.output
128-
assert "Server Information:" in result.output
129-
assert "Installation Details:" in result.output
130-
assert "Example:" in result.output
128+
# Table output won't have these detailed sections that were in the detailed view
129+
# assert "Server Information:" in result.output
130+
# assert "Installation Details:" in result.output
131+
# assert "Example:" in result.output
131132
assert "Found 1 server(s) matching search criteria" in result.output
132133
mock_repo_manager.search_servers.assert_called_once_with(None)
133134

@@ -149,8 +150,8 @@ def test_search_error_handling(monkeypatch):
149150
mock_repo_manager.search_servers.assert_called_once_with(None)
150151

151152

152-
def test_search_with_query_and_detailed(monkeypatch):
153-
"""Test searching with both a query and detailed view"""
153+
def test_search_with_query_and_table(monkeypatch):
154+
"""Test searching with both a query and table view"""
154155
# Mock repository manager
155156
mock_repo_manager = Mock()
156157
mock_repo_manager.search_servers = Mock(
@@ -181,15 +182,13 @@ def test_search_with_query_and_detailed(monkeypatch):
181182
)
182183
monkeypatch.setattr("mcpm.commands.search.repo_manager", mock_repo_manager)
183184

184-
# Run the command with both query and detailed flag
185+
# Run the command with both query and table flag
185186
runner = CliRunner()
186-
result = runner.invoke(search, ["test", "--detailed"])
187+
result = runner.invoke(search, ["test", "--table"])
187188

188189
assert result.exit_code == 0
189190
assert "Searching for MCP servers matching 'test'" in result.output
190191
assert "Test Server" in result.output
191-
assert "Server Information:" in result.output
192-
assert "Installation Details:" in result.output
193-
assert "Example:" in result.output
192+
assert "A test server" in result.output
194193
assert "Found 1 server(s) matching search criteria" in result.output
195194
mock_repo_manager.search_servers.assert_called_once_with("test")

0 commit comments

Comments
 (0)