Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Thumbs.db
*.swo
output_tests
target/*
context_portal/*
43 changes: 40 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ rand = "0.8"
clap = { version = "4.4", features = ["derive"] }
html2md = "0.2.14"
regex = "1"
syn = { version = "2.0.104", features = ["full"] }
flate2 = "1.1.2"
tar = "0.4.44"

[dev-dependencies]
# Testing utilities
Expand Down
63 changes: 29 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ This is an MCP (Model Context Protocol) server that provides tools for Rust crat
## Installation

```bash
git clone https://github.com/d6e/cratedocs-mcp.git
git clone https://github.com/promptexecution/cratedocs-mcp.git
cd cratedocs-mcp
cargo build --release
cargo install --path .
```

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

### Directly Testing Documentation Tools

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

```bash
Expand Down Expand Up @@ -189,47 +193,38 @@ in `mcp_settings.json`
```


## License

MIT License

## MCP Tool: `list_crate_items`
### 4. `list_crate_items`

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.
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.

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

```sh
cargo run --bin cratedocs -- list-crate-items --crate-name serde --version 1.0.0
**Example:**
```json
{
"name": "list_crate_items",
"arguments": {
"crate_name": "serde",
"version": "1.0.0",
"item_type": "struct"
}
}
```

#### With filters:

- Filter by item type (e.g., struct, enum, trait, fn, macro, mod):

```sh
cargo run --bin cratedocs -- list-crate-items --crate-name serde --version 1.0.0 --item-type struct
```

- Filter by visibility (e.g., pub, private):

```sh
cargo run --bin cratedocs -- list-crate-items --crate-name serde --version 1.0.0 --visibility pub
```

- Filter by module path:

```sh
cargo run --bin cratedocs -- list-crate-items --crate-name serde --version 1.0.0 --module serde::de
```

### Output

The output is a concise, categorized list (JSON or markdown) showing each item's name, type, visibility, and module path.

**Example (stub output):**
**Example Output (stub):**
```
Stub: list_crate_items for crate: serde, version: 1.0.0, filters: Some(ItemListFilters { item_type: Some("struct"), visibility: None, module: None })
```

When implemented, the output will be a structured list of items matching the filters.


## License

MIT License
Loading