Android Studio Agent Mode Integration¶
Pisama exposes its detectors to Android Studio's Agent Mode via the Pisama MCP server. Agent Mode speaks MCP over stdio, so wiring Pisama in requires no new transport or auth surface.
Overview¶
Inside Android Studio Agent Mode you can:
- List available detectors — filtered to the
productiontier by default. - Run a specific detector on a captured trace.
- Run full analysis with every detector in one call.
- Explain a failure type — surface detection methodology next to the code you're editing.
No API key, no backend, no network. The MCP server runs locally against pisama-core.
Installation¶
Verify the CLI:
Configure Android Studio Agent Mode¶
Open Settings → Tools → AI Assistant → MCP Servers and add:
Restart Android Studio. Open Agent Mode and confirm the server connected by prompting:
list pisama detectors
You should see the production-tier detector roster with tier, description, and version.
Available Tools¶
| Tool | Purpose |
|---|---|
pisama_list_detectors | List detectors. Optional tier filter (production / beta / experimental / all). |
pisama_detect | Run one named detector against a trace. |
pisama_analyze | Run the full detector suite. |
pisama_status | Session stats (analyses run, issues found, recent results). |
pisama_explain | Documentation for a failure type. |
Typical workflow¶
- Agent Mode runs a multi-step task and captures its trace via OTEL.
- Export the trace JSON to your workspace.
- Prompt: "run pisama analysis on
trace.json" →pisama_analyzereturns the full detection envelope. - For a specific concern: "check this trace for loops" →
pisama_detectwithdetector: "loop".
Tier behavior¶
pisama_list_detectors defaults to tier: "production". Production detectors meet the F1 / regression gates in backend/app/detection_enterprise/calibrate.py::TIER_GATES. Beta detectors are still under calibration and may emit false positives; pass tier: "beta" when you want them.
Troubleshooting¶
Agent Mode cannot start the server. Run pisama mcp-server in a terminal — if it starts there, the configuration path is correct. If the command is missing, reinstall pisama into the Python interpreter Android Studio is pointed at.
"Unknown tool" errors. Verify pisama >= 1.6.3; pisama_list_detectors was added in that release.
Empty detector list. The production filter is aggressive. Try tier: "all" to confirm detectors loaded, then narrow back down.