Skip to content

Commit 5227663

Browse files
dguidoclaude
andauthored
Expand tool descriptions to follow Anthropic best practices (#10)
Update all 23 MCP tool descriptions from compressed format (~15 words) to detailed descriptions (48-67 words each) following Anthropic's official guidance for tool use. Each description now includes: - What the tool does - When to use it - What it returns - Caveats/limitations This aligns with Anthropic's recommendation of "at least 3-4 sentences per tool description" for optimal tool selection by Claude. Also includes: - New get_storage_layout tool for storage slot analysis - Minor fixes to find_dead_code and list_functions - Version bump to 2.2.0 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5373192 commit 5227663

File tree

11 files changed

+973
-363
lines changed

11 files changed

+973
-363
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "slither-mcp"
3-
version = "2.2.0"
3+
version = "2.3.0"
44
description = "MCP server for Slither static analysis of Solidity contracts"
55
readme = "README.md"
66
requires-python = ">=3.11"

slither_mcp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Slither MCP Server - MCP server for Slither static analysis."""
22

3-
__version__ = "0.1.0"
3+
__version__ = "2.3.0"

slither_mcp/tool_registry.py

Lines changed: 163 additions & 343 deletions
Large diffs are not rendered by default.

slither_mcp/tools/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@
7676
InheritanceNode,
7777
get_inherited_contracts,
7878
)
79+
from slither_mcp.tools.get_storage_layout import (
80+
GetStorageLayoutRequest,
81+
GetStorageLayoutResponse,
82+
StorageSlotInfo,
83+
get_storage_layout,
84+
)
7985
from slither_mcp.tools.get_project_overview import (
8086
GetProjectOverviewRequest,
8187
GetProjectOverviewResponse,
@@ -165,6 +171,11 @@
165171
"GetDerivedContractsRequest",
166172
"GetDerivedContractsResponse",
167173
"get_derived_contracts",
174+
# Storage layout
175+
"StorageSlotInfo",
176+
"GetStorageLayoutRequest",
177+
"GetStorageLayoutResponse",
178+
"get_storage_layout",
168179
"ImplementationInfo",
169180
"ListFunctionImplementationsRequest",
170181
"ListFunctionImplementationsResponse",

slither_mcp/tools/find_dead_code.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
from slither_mcp.pagination import PaginatedRequest, apply_pagination
1313
from slither_mcp.types import ContractKey, FunctionKey, ProjectFacts, path_matches_exclusion
1414

15+
# Default paths to exclude when exclude_test_frameworks is True
16+
DEFAULT_TEST_FRAMEWORK_PATHS = [
17+
"lib/forge-std/",
18+
"lib/ds-test/",
19+
"node_modules/",
20+
]
21+
1522

1623
class DeadCodeFunction(BaseModel):
1724
"""A function identified as potentially dead code."""
@@ -46,6 +53,13 @@ class FindDeadCodeRequest(PaginatedRequest):
4653
list[str] | None,
4754
Field(description="Path prefixes to exclude (e.g., ['lib/', 'node_modules/'])"),
4855
] = None
56+
exclude_test_frameworks: Annotated[
57+
bool,
58+
Field(
59+
description="Exclude common test framework paths like lib/forge-std/, lib/ds-test/, "
60+
"node_modules/ (default: True)"
61+
),
62+
] = True
4963

5064

5165
class FindDeadCodeResponse(BaseModel):
@@ -178,14 +192,19 @@ def find_dead_code(
178192
else:
179193
contracts_to_check = list(project_facts.contracts.items())
180194

195+
# Build effective exclusions list
196+
effective_exclusions = list(request.exclude_paths or [])
197+
if request.exclude_test_frameworks:
198+
effective_exclusions.extend(DEFAULT_TEST_FRAMEWORK_PATHS)
199+
181200
for contract_key, contract_model in contracts_to_check:
182201
# Skip interfaces and libraries for dead code analysis
183202
if contract_model.is_interface or contract_model.is_library:
184203
continue
185204

186205
# Skip contracts matching exclude_paths
187-
if request.exclude_paths:
188-
if path_matches_exclusion(contract_key.path, request.exclude_paths):
206+
if effective_exclusions:
207+
if path_matches_exclusion(contract_key.path, effective_exclusions):
189208
continue
190209

191210
# Check declared functions

0 commit comments

Comments
 (0)