Skip to content

Commit a06a7ef

Browse files
authored
Add storage-bisect tool (#3)
* Update CLAUDE.md * Add storage_bisect tool * fixup! Add storage_bisect tool * fixup! fixup! Add storage_bisect tool
1 parent 4e3819b commit a06a7ef

File tree

7 files changed

+969
-55
lines changed

7 files changed

+969
-55
lines changed

CLAUDE.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,32 @@ The project can be installed via:
9595
- `cargo install --git https://github.com/Moonsong-Labs/substrate-mcp`
9696
- Local build: `cargo build --release`
9797

98-
For Claude Code configuration, see README.md for detailed setup instructions.
98+
For Claude Code configuration, see README.md for detailed setup instructions.
99+
## Substrate Integration Guidelines
100+
101+
### Preferred Crates
102+
When interacting with Substrate nodes, always prefer using the official `polkadot-sdk` crates over third-party alternatives:
103+
- Use `sc-rpc-api` for RPC client traits
104+
- Use `sp-core` for core types and primitives
105+
- Use `sp-runtime` for runtime types
106+
- Use `jsonrpsee` for WebSocket client (this is what polkadot-sdk uses internally)
107+
108+
### RPC Communication Pattern
109+
For RPC communication with Substrate nodes:
110+
1. Use `jsonrpsee` to create WebSocket clients
111+
2. Use the traits from `sc-rpc-api` for type safety
112+
3. Prefer simple sequential async/await over complex parallelization
113+
4. Natural rate limiting through sequential requests is often sufficient
114+
115+
### Code Design Principles
116+
1. **Simplicity First**: Start with simple sequential code before adding complexity
117+
2. **Avoid Over-engineering**: Don't use parallelization libraries like `rayon` for I/O-bound operations
118+
3. **Use Async/Await**: Substrate RPC operations are I/O-bound, use tokio's async runtime
119+
4. **Error Handling**: Use `anyhow` for error propagation in tool implementations
120+
121+
### Common RPC Methods for Storage
122+
When working with storage:
123+
- `state_getKeysPaged`: Fetch storage keys with pagination
124+
- `state_getStorage`: Get storage value at specific block
125+
- `chain_getBlockHash`: Get block hash from block number
126+
- Always handle SCALE encoding/decoding appropriately

0 commit comments

Comments
 (0)