Skip to content

Commit 948a515

Browse files
Merge pull request #3 from PromptExecution/feature/list-crate-items
feature/list crate items
2 parents 34f5e7a + a13d2be commit 948a515

File tree

9 files changed

+311
-83
lines changed

9 files changed

+311
-83
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ Thumbs.db
2424
*.swo
2525
output_tests
2626
target/*
27+
context_portal/*

Cargo.lock

Lines changed: 40 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ rand = "0.8"
4747
clap = { version = "4.4", features = ["derive"] }
4848
html2md = "0.2.14"
4949
regex = "1"
50+
syn = { version = "2.0.104", features = ["full"] }
51+
flate2 = "1.1.2"
52+
tar = "0.4.44"
5053

5154
[dev-dependencies]
5255
# Testing utilities

README.md

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ This is an MCP (Model Context Protocol) server that provides tools for Rust crat
1111
## Installation
1212

1313
```bash
14-
git clone https://github.com/d6e/cratedocs-mcp.git
14+
git clone https://github.com/promptexecution/cratedocs-mcp.git
1515
cd cratedocs-mcp
1616
cargo build --release
17+
cargo install --path .
1718
```
1819

1920
## Running the Server
@@ -40,6 +41,9 @@ cargo run --bin cratedocs http --debug
4041

4142
### Directly Testing Documentation Tools
4243

44+
# Enumerate crate items
45+
cargo run --bin cratedocs test --tool list_crate_items --crate-name serde --version 1.0.0 --item-type struct
46+
cargo run --bin cratedocs test --tool list_crate_items --crate-name tokio --version 1.28.0 --visibility pub --module tokio::sync
4347
You can directly test the documentation tools from the command line without starting a server:
4448

4549
```bash
@@ -189,47 +193,38 @@ in `mcp_settings.json`
189193
```
190194

191195

192-
## License
193-
194-
MIT License
195196

196-
## MCP Tool: `list_crate_items`
197+
### 4. `list_crate_items`
197198

198-
The `list_crate_items` tool enumerates all items in a specified Rust crate and version, optionally filtering by item type, visibility, or module path. This is useful for quickly exploring the structure of a crate, generating concise listings for LLMs, or programmatically analyzing crate APIs.
199+
Enumerates all items in a specified Rust crate and version, optionally filtering by item type, visibility, or module path. Useful for exploring crate structure, generating concise listings for LLMs, or programmatically analyzing crate APIs.
199200

200-
### Usage
201+
**Parameters:**
202+
- `crate_name` (required): The name of the crate
203+
- `version` (required): The version of the crate
204+
- `item_type` (optional): Filter by item type (struct, enum, trait, fn, macro, mod)
205+
- `visibility` (optional): Filter by visibility (pub, private)
206+
- `module` (optional): Filter by module path (e.g., serde::de)
201207

202-
```sh
203-
cargo run --bin cratedocs -- list-crate-items --crate-name serde --version 1.0.0
208+
**Example:**
209+
```json
210+
{
211+
"name": "list_crate_items",
212+
"arguments": {
213+
"crate_name": "serde",
214+
"version": "1.0.0",
215+
"item_type": "struct"
216+
}
217+
}
204218
```
205219

206-
#### With filters:
207-
208-
- Filter by item type (e.g., struct, enum, trait, fn, macro, mod):
209-
210-
```sh
211-
cargo run --bin cratedocs -- list-crate-items --crate-name serde --version 1.0.0 --item-type struct
212-
```
213-
214-
- Filter by visibility (e.g., pub, private):
215-
216-
```sh
217-
cargo run --bin cratedocs -- list-crate-items --crate-name serde --version 1.0.0 --visibility pub
218-
```
219-
220-
- Filter by module path:
221-
222-
```sh
223-
cargo run --bin cratedocs -- list-crate-items --crate-name serde --version 1.0.0 --module serde::de
224-
```
225-
226-
### Output
227-
228-
The output is a concise, categorized list (JSON or markdown) showing each item's name, type, visibility, and module path.
229-
230-
**Example (stub output):**
220+
**Example Output (stub):**
231221
```
232222
Stub: list_crate_items for crate: serde, version: 1.0.0, filters: Some(ItemListFilters { item_type: Some("struct"), visibility: None, module: None })
233223
```
234224

235225
When implemented, the output will be a structured list of items matching the filters.
226+
227+
228+
## License
229+
230+
MIT License

0 commit comments

Comments
 (0)