Repository navigation
What's new
A new MCP tool — capture_performance_snapshot — that lets your AI assistant get a quick, structured read on Unity performance without you having to open the Profiler.
Why it's useful
Before: "the scene feels laggy" was a subjective handoff. You'd open the Profiler, eyeball the graph, screenshot it, paste numbers into chat.
Now: one tool call returns hard data — "max frame time 106ms vs 16.6ms target, 174 samples over 3s". Your AI agent can act on facts instead of guesses, and even close the loop: change code → re-snapshot → compare.
What it captures
- In Play Mode: frame timing (avg/min/max ms + fps) sampled every frame after a configurable warmup, plus memory (
Profiler.GetTotalReservedMemoryLong, Mono heap/used). - In Edit Mode: memory only, with an honest warning. The tool refuses to fake frame timing from editor repaints — those numbers would be meaningless.
- Warnings: fires when any frame exceeds the
targetFpsThresholdbudget, or when memory counters come back empty.
Parameters
| Param | Default | Notes |
|---|---|---|
durationSeconds |
5 | Post-warmup sampling window |
warmupSeconds |
1 | Frames during warmup are discarded |
targetFpsThreshold |
60 | Used for the over-budget warning |
includeMemory |
true | Skip if you only want frame stats |
Duration is auto-clamped to fit inside RequestTimeoutSeconds - 5s and hard-capped at 20s, so MCP calls never hang.
Example prompts
- "Capture a 5 second performance snapshot while the game is running."
- "Take a memory snapshot of the editor right now."
- "Sample frames for 10 seconds at 30fps target and tell me if we miss budget."
Notes for upgraders
- No breaking changes. New tool only.
- Locale-safe text output (
1.0s,56.2 fps) regardless of system locale. - 12 new tests (7 NUnit + 5 Jest), all green; full Node suite at 190/190.
Out of scope (planned for later)
start_performance_capture/stop_performance_capturefor sessions longer than 20sProfilerRecorder-based counters (render thread, GC alloc, physics)- Memory Profiler
.snapintegration