Skip to main content
Glama
phunkaeg

apitrace-mcp

by phunkaeg

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
APITRACE_MCP_TRACE_DIRNoSets where traces, logs and extracted files go.%LOCALAPPDATA%\apitrace-mcp\traces
APITRACE_MCP_ROOT_WIN32NoPath to the win32 apitrace build. Overrides auto-discovery.
APITRACE_MCP_ROOT_WIN64NoPath to the win64 apitrace build. Overrides auto-discovery.

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
apitrace_statusA

Preflight: which apitrace builds are installed, where traces go, what is running.

Call this before anything else. Unlike the GUI-backed RE servers, apitrace needs no host application running -- but it does need the build whose bitness matches the game you intend to trace.

list_tracesA

List trace files in the trace directory.

detect_targetA

Inspect a game executable: bitness, graphics API, and how to trace it.

Reads the PE import table, so it answers "is this D3D8 or D3D9, and is it 32-bit" without launching anything. Delay-loaded imports are included -- older games often delay-load d3d9 behind a video-detection step.

trace_launchA

Launch a game under apitrace and start capturing. Returns a session id.

This runs the game -- it does not block. Let the user play the part they want captured, then call trace_stop (ideally after they quit the game normally, so the trace is flushed cleanly).

api: gl, d3d7, d3d8, d3d9, or dxgi (D3D10/11). Empty auto-detects from the PE. method: 'iat' (default) or 'mhook'. Try mhook when a game loads the graphics DLL dynamically and IAT patching misses it.

trace_statusA

Poll a trace or replay session: still running, trace size so far, log tail.

trace_stopA

Stop a session and report the resulting trace.

Prefer quitting the game in-game first: a forced kill can lose the tail of the trace because apitrace never gets to flush.

list_sessionsA

All trace/replay sessions, including any still running from a previous server run.

install_wrapperA

Drop apitrace's wrapper DLL next to a game exe (the manual tracing route).

Use this when trace_launch produces nothing -- typically because the exe you launched is a launcher that spawns the real game, or the game re-launches itself for DRM. The wrapper then loads whenever the game starts, however it was started (including from Steam).

Any existing DLL of the same name -- ENB, ReShade, dgVoodoo, DXVK all use these filenames -- is backed up and restored by uninstall_wrapper. Always uninstall when you are done; a left-behind wrapper keeps tracing every run.

uninstall_wrapperB

Remove wrapper DLLs installed by install_wrapper and restore any backups.

trace_infoB

Summary of a trace file: API, call count, frame count (JSON from apitrace info).

dump_callsA

Human-readable call dump, exactly as apitrace dump writes it. Good for eyeballing a stretch of a frame; use get_calls for numeric arguments. Calls: apitrace callset syntax: '42' one call, '0,2,4' a set, '100-2000' a range, '0-1000/2' every 2nd, '0-1000/draw' draw calls only, '0-1000/fbo' render-target changes, 'frame' the end-of-frame calls, '@file.txt' read from a file.

get_callsA

Structured calls with real argument values via apitrace pickle. Long arrays and blobs are summarized. Calls: apitrace callset syntax: '42' one call, '0,2,4' a set, '100-2000' a range, '0-1000/2' every 2nd, '0-1000/draw' draw calls only, '0-1000/fbo' render-target changes, 'frame' the end-of-frame calls, '@file.txt' read from a file.

search_callsA

Regex search over function names across the trace; returns counts and call numbers.

The cheapest way to find out whether a game uses fixed-function transforms or shader constants: search 'SetTransform|SetVertexShaderConstant'.

call_histogramB

Function-frequency profile over a call range -- the fastest way to see what a game does.

Scanning the whole of a large trace is slow; limit caps how many calls are read (default 200k).

frame_summaryA

Break a frame down: draw calls, render-target switches, shader binds.

Pass a callset covering one frame, e.g. calls='120000-125000'. Use trace_info(per_frame=True) or list_frames to find the boundaries.

list_framesB

Frame boundaries as call numbers, so you can scope other queries to one frame.

find_matricesA

Find and classify every 4x4 matrix the game sends to the driver.

This is the core VR/camera-hacking tool. It covers:

  • fixed-function transforms -- SetTransform(D3DTS_VIEW/PROJECTION/WORLD), glLoadMatrixf/glMultMatrixf, glFrustum/glOrtho;

  • shader constants -- SetVertexShaderConstantF and friends, tracked through a shadow register file so matrices uploaded piecemeal still resolve, and reported as the register range that holds them (e.g. vs_c[8..11]);

  • uniform/constant buffer uploads -- glBufferData, UpdateSubresource and the memcpy calls apitrace records for writes to mapped memory, reported as a byte offset into the buffer (set scan_buffers=false to skip);

  • both storage orders, since D3D9 shader constants usually hold the transpose.

Results are grouped by slot. Read them as: kind=projection -> the game's FOV, near and far planes kind=rigid + changes_per_frame -> camera candidate; confirm with track_camera kind=viewproj in vs_c[...] -> the register range a VR patch rewrites kind=viewproj at a buffer offset -> the bytes a VR patch rewrites kind=ortho -> HUD/UI or shadow pass

Scope with calls (a single frame is usually enough and far faster).

decode_matrixA

Decode 16 floats as a 4x4 matrix: FOV, near/far, handedness, camera position.

Accepts whitespace-, comma- or newline-separated numbers -- paste them straight out of a memory dump, a Cheat Engine watch, or a shader constant. Both storage orders are tried, so you do not need to know whether the source was row- or column-major.

track_cameraA

Follow the camera across frames: world position, forward vector and FOV.

Picks the most view-like matrix slot automatically, or pass source with a slot name from find_matrices. If the eye position changes as the player moved during the capture, you have found the real view matrix -- that is the confirmation step before taking the offset into Ghidra or ReGenny.

list_shadersB

List shader creation calls with a source preview or bytecode size.

Use extract_blobs to write D3D shader bytecode out for disassembly.

extract_blobsA

Write binary arguments (shader bytecode, vertex/index/constant buffers) to files.

Scope tightly with calls -- buffer uploads are large and there are many. The scan walks at most max(limit*500, 20000) calls of the callset, so blobs beyond that walk cap are not found; narrow calls if the result looks short.

dump_stateA

Replay up to a call and dump the full pipeline/device state as JSON.

The apitrace equivalent of RenderDoc's pipeline view for OpenGL and D3D8/D3D9. DirectDraw and D3D7 traces are capture-only upstream and cannot be replayed for state inspection.

Replay has to run the trace on this machine's GPU up to that call, so it is slow and it can fail on very old games whose resources the driver no longer likes. If it fails, trim_trace to a short range first.

dump_imagesB

Replay the trace and write PNG images (per frame, or per specified call).

Useful for finding which draw call produces the HUD, the world, or the problem you are chasing -- dump images at every draw in a frame and look.

trim_traceA

Make a raw call/frame slice of a trace.

A slice beginning at call/frame zero often remains replayable and makes every downstream tool faster. A mid-run OpenGL slice can omit setup/resources; use gltrim_trace when replayability matters.

gltrim_traceC

OpenGL-specific frame trim that preserves replay setup state.

leak_reportA

Run apitrace's object-leak checker against a trace.

repack_traceC

Repack a trace with Snappy, Brotli, Zstandard, or zlib compression.

diff_tracesA

Compare two traces with apitrace's semantic call-stream differ.

diff_stateB

Capture and compare complete retracer state at two calls.

diff_imagesA

Compare image sets and create an HTML report plus new diff/thumbnail sidecars.

Upstream writes sidecars beside the source prefixes. This wrapper refuses to run if any potential sidecar already exists and never enables --overwrite.

sed_traceC

Stream-edit trace enum/string symbols or trace properties into a new trace.

replay_traceB

Replay a trace in the background (session-based). Returns a session id.

profile: '', 'cpu', 'gpu', 'frames', 'pixels', 'memory', 'calls', 'frame_metrics', or 'draw_metrics'. Profiling output lands in the session log -- poll it with trace_status.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/phunkaeg/apitrace-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server