pi-shazam
Pi编码代理的代码库意识工具包,包含由tree-sitter和LSP支持的7种结构分析工具,为您的代理提供对任何项目的深入理解。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"pi-shazam": {
"args": [
"-y",
"-p",
"pi-shazam@latest",
"pi-shazam-mcp"
],
"command": "npx"
}
}
}
可用工具 (7 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
shazam_overview 3 个参数
When you first enter a project or return after changes - use this to understand the codebase before reading a single file. Returns module dependency map, top-10 PageRank files, key dependencies, recent git changes, entry points, reading order, HTTP routes, and complexity hotspots ranked by blast radius.
该工具无需必填参数,直接调用即可
shazam_lookup 7 个参数 需填 1 项
Look up anything in the codebase - a symbol by name or a file by path. Auto-detects whether the input is a file path or symbol name and returns the most relevant information: definition, kind, signature, type hierarchy, file structure, PageRank, callers/callees. Use mode=state for enum/state analysis. Pass showCallbacks=true to expand anonymous functions.
必填参数:name
shazam_impact 9 个参数
Required before editing 2+ files or any shared/exported module. Returns every file, symbol, and test affected by your planned changes. Pass --symbol for per-symbol caller/callee tracing. Pass --flat for a flat list of references. Pass --direction to filter by incoming/outgoing/both. Pass --with-symbols for per-symbol risk breakdown. Pass --compact for concise output. Pass --depth to control BFS traversal depth (default 3).
该工具无需必填参数,直接调用即可
shazam_verify 8 个参数
After every write or edit, run this to confirm no errors were introduced. Runs LSP diagnostics (type errors, warnings), then graph analysis (git diff, risk level, orphan detection, graph diffs). Verdict: PASS / WARN / FAIL. Use --quick for a fast git-change-only check (~2s). Use --lspOnly for diagnostics only. Use --preCommit for stricter thresholds.
该工具无需必填参数,直接调用即可
shazam_changes 2 个参数
Without this, you optimize the wrong files. Returns a concise summary of what changed in the working tree: changed files, affected symbols, risk level, and which callers may be impacted. Use after edits to see the blast radius before running full verification.
该工具无需必填参数,直接调用即可
shazam_format 4 个参数
When shazam_verify reports format or lint errors, use this to auto-fix them. Runs nearest-wins formatters (prettier, biome, eslint --fix, ruff, cargo fmt, gofmt). Format only - never touches logic. Use --dry-run to preview when unsure.
该工具无需必填参数,直接调用即可
shazam_rename_symbol 5 个参数 需填 2 项
Required safety gate before renaming any symbol. Step 1: call shazam_impact --symbol to review all references. Step 2: use this to perform the project-wide rename via LSP textDocument/rename. Step 3: call shazam_verify to confirm no broken references. This is a WRITE operation - do not manually find-and-replace; missed references become bugs.
必填参数:symbol、newName
服务介绍
pi-shazam
Codebase awareness toolkit for the Pi coding agent — 7 structural analysis tools powered by tree-sitter and LSP that give your agent deep understanding of any project.
Installation
Two ways to use pi-shazam, depending on your agent:
Native Extension — Pi Coding Agent only
For the Pi coding agent. Installs as a first-class extension — tools appear alongside read/write/bash with no distinction.
pi install npm:pi-shazam
MCP Server — all other AI agents
For Kimi Code, CodeBuddy, Qwen Code, Claude, Codex, Qoder, Trae, and any MCP-compatible client.
{
"mcpServers": {
"pi-shazam": {
"command": "npx",
"args": ["-y", "-p", "pi-shazam@latest", "pi-shazam-mcp"]
}
}
}
Analysis Tools
| Tool | When to use | What it does |
|---|---|---|
shazam_overview |
First entry, need project structure | Project summary: top files, dependencies, hotspots, entry points, key data structures |
shazam_lookup |
Need symbol details or concept search | Unified lookup + fuzzy concept search ("how is X implemented") |
shazam_impact |
Before editing shared or exported modules | Blast radius analysis — every file, symbol, and test affected by a change |
shazam_verify |
After every write or edit | Post-edit verification: LSP diagnostics with auto-detection of unreliable servers, graph analysis, PASS/WARN/FAIL |
shazam_changes |
After edits to see what changed | Git change summary with symbol-level detail, risk level, affected callers |
shazam_format |
When shazam_verify reports format errors |
Auto-fix formatting (prettier, biome, eslint, ruff, cargo fmt, gofmt) |
shazam_rename_symbol |
Before renaming any symbol | LSP cross-file symbol rename with atomic writes |
Slash Commands
Setup and hook installation run automatically on session start. No manual setup commands needed.
| Command | When | Purpose |
|---|---|---|
/shazam-doctor |
When troubleshooting | Health check: LSP status, recent errors, slow calls, safety status |
Supported Languages
| Language | Tree-sitter | LSP |
|---|---|---|
| Python | Yes | pyright / pylsp |
| TypeScript | Yes | typescript-language-server |
| JavaScript | Yes | typescript-language-server |
| Go | Yes | gopls |
| Rust | Yes | rust-analyzer |
| Dart | Yes | dart language-server |
| JSON | Yes | vscode-json-language-server |
| YAML | - | yaml-language-server |
Platform Support
| Platform | Status |
|---|---|
| Linux | Supported |
| macOS | Supported |
| Windows | Not supported (tree-sitter native bindings) |