35 Commits

Author SHA1 Message Date
Bartosz Taudul
fc5318dcad Some more markdown user manual compatibility fixes. 2026-06-06 01:53:05 +02:00
Bartosz Taudul
661c664b75 Converte LaTeX math in markdown to plain text. 2026-06-06 01:44:27 +02:00
Bartosz Taudul
73d78ad517 Fix tables in markdown manual. 2026-06-06 01:25:49 +02:00
Bartosz Taudul
715815374d Rebuild markdown manual. 2026-06-05 18:42:50 +02:00
Bartosz Taudul
189e8a1a89 Regenerate markdown manual. 2026-05-30 19:00:39 +02:00
Bartosz Taudul
b736e4590e Rebuild markdown manual. 2026-05-27 01:52:11 +02:00
Bartosz Taudul
c11fd010d8 Rebuild markdown manual. 2026-05-27 00:10:33 +02:00
Bartosz Taudul
6276f1b12a Rebuild markdown manual. 2026-05-02 00:38:44 +02:00
Alan Tse
9a7233ced5 Add MCP server for AI-assisted trace analysis (#1347)
* Add MCP server for AI-assisted trace analysis.

Introduce an optional Model Context Protocol (MCP) server that lets AI
assistants analyze Tracy captures and live sessions through Tracy's own
server engine. The server runs as a Python sidecar and talks to the
existing C++ analysis code through new pybind11 bindings.

- python/bindings/ServerModule.cpp: TracyServerBindings module exposing
  Worker, file I/O, zones, GPU zones, frame data, plots, messages, locks,
  source locations, and summary statistics (zone/GPU child stats, frame
  timing, etc.).
- python/CMakeLists.txt: builds and installs TracyServerBindings alongside
  TracyClientBindings.
- extra/mcp/tracy_mcp.py: FastMCP SSE singleton with dynamic port
  discovery, PID-file based singleton detection, session-isolated worker
  instances, synchronous and background eval, task polling, and a
  shutdown tool to release the .pyd lock during development.
- extra/mcp/start_mcp.sh, .gitignore: launcher with local override hook;
  ignores generated port/pid files.
- manual/tracy.md: documents building, running, and integrating the
  server with an AI assistant.

* Improve Tracy MCP cold-start guidance.

Cold-start usability testing showed an LLM agent burned ~7 exploratory
calls discovering the ctx object model, time-unit conventions, and join
keys before producing useful analysis. Surface that information up front
through MCP resources and entry-point tool guidance.

- extra/mcp/eval_guide.md: new bindings-layer reference covering the
  Worker object graph (zone / GPU zone / frame / thread / message /
  plot / lock / memory entry points), nanosecond time units, ZoneStats
  field semantics including self-time via get_child_zone_stats, the
  opaque 'name (addr)[arch] <srcloc_id>' key format, and worked
  examples translating common queries into ctx Python.
- extra/mcp/tracy_mcp.py: expose system.prompt.md and eval_guide.md as
  MCP resources (tracy://prompt and tracy://eval-guide) so external
  agents and Tracy Assist share the same guidance source. Resource
  content is re-read per request — edits propagate without a server
  restart.
- Point load_capture and live_connect return values plus the eval tool
  description at the resources, so the agent reads them before its
  first eval rather than introspecting blind.
- Expand load_capture docstring: name the path parameter explicitly,
  show Windows path syntax, and direct agents to list_captures plus
  TRACY_CAPTURES_DIR for capture discovery.
- Probe is_connected() briefly after Worker construction in
  live_connect and surface an actionable error on silent handshake
  failures (typically a Tracy client/server version mismatch or
  TRACY_ON_DEMAND) instead of returning misleading success.

Reduces a fresh agent's cold-start overhead from 7 exploratory calls
to 4, where the remaining 4 are unavoidable harness/schema-fetch
overhead, not API-design friction.

* Detect Tracy protocol mismatches via UDP broadcast pre-flight.

Tracy clients announce themselves on UDP port 8086 every ~3 seconds with
a BroadcastMessage carrying the protocol version, listen port, and
program name (public/common/TracyProtocol.hpp). The Tracy GUI reads this
and refuses to attempt a TCP connection on protocol mismatch, surfacing
a precise error. live_connect previously had no equivalent check, so a
mismatch produced an opaque 2-second handshake timeout with no
diagnostic about what was wrong.

- Add a broadcast parser handling versions 0-3, with variable-length
  programName (Tracy sends only the actual name + null terminator on
  the wire, not the full 64-byte buffer).
- Add a non-blocking UDP listener that binds 8086 with SO_REUSEADDR
  and waits up to 3.5s — enough to guarantee catching at least one
  beat at the 3s broadcast cadence.
- Read our bindings' ProtocolVersion at startup by parsing
  TracyProtocol.hpp, so the comparison stays in sync with the build
  without new C++ wiring.
- live_connect runs the broadcast pre-flight before constructing
  Worker. On a matched listen_port with a differing protocol_version,
  it returns a single-line error naming the program, both versions,
  and the remediation, without ever opening a TCP connection. If no
  matching broadcast arrives, it falls through to the existing
  handshake probe, which now reports any other broadcasts seen as a
  hint (helpful when the target uses a non-default port).

* Add MCP Server section to LaTeX manual.

The markdown manual is auto-generated from the LaTeX source; add the
corresponding \subsection{MCP Server} so the two stay in sync.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Remove hand-written MCP section from tracy.md.

tracy.md is generated from tracy.tex via latex2md.sh. The MCP section
was previously written by hand directly in the markdown; now that the
LaTeX source has been updated, the markdown section should be
regenerated by running latex2md.sh rather than maintained manually.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 16:17:55 +02:00
Bartosz Taudul
2c6adfb416 Regenerate markdown manual. 2026-04-23 00:28:59 +02:00
Bartosz Taudul
add9a77396 Document tracy-capture-daemon and reorganize merge section
- Add subsection about tracy-capture-daemon in the capturing section
- Move merge tool documentation to follow capture daemon section
- Both tools are now documented as part of the capture workflow
2026-03-02 22:39:18 +01:00
Bartosz Taudul
f5545f864d Document tracy-merge utility in the manual 2026-03-02 20:36:22 +01:00
Bartosz Taudul
ad659b8f8e Update manual. 2026-02-26 22:33:50 +01:00
Bartosz Taudul
38b73254e9 Add emoji font. 2026-01-14 01:51:32 +01:00
Bartosz Taudul
ce74512b92 Update manual. 2026-01-14 00:58:07 +01:00
Bartosz Taudul
b17002a9c0 Update markdown manual. 2025-12-31 15:28:05 +01:00
Bartosz Taudul
154712bc81 Keep user manual chunks in a separate object.
This makes the user manual available outside of the LLM context.

The code is also more readable, as splitting the manual into sections and
splitting section content into chunks fit for embeddings is now separated.
A bug has been fixed, where the above splits were mixed up for the last
manual section, producing invalid data.

The unembedded manual contents are no longer held in the memory. The only
use case for this was to calculate the manual contents hash. The hash is
now precalculated and cached.
2025-11-29 20:16:00 +01:00
Bartosz Taudul
e6b9ea4609 Release 0.13.0. 2025-11-11 16:31:54 +01:00
Bartosz Taudul
0a5aa506b6 Update markdown manual. 2025-09-16 22:34:16 +02:00
Moritz Heinemann
18e75668a9 Update markdown manual. 2025-08-14 19:36:04 +02:00
sebi
5ee82874c6 manual: OpenCL macro name fix 2025-08-04 10:17:30 +03:00
Bartosz Taudul
6f3a023df8 Update markdown manual. 2025-07-23 00:57:26 +02:00
Bartosz Taudul
382b41bcce Add example llama-swap configuration to the manual. 2025-07-15 14:32:49 +02:00
Bartosz Taudul
d9a1655f9a Add information about CPU dies to topology section in the manual. 2025-07-15 14:04:21 +02:00
Bartosz Taudul
24b43e9e0a Update manual. 2025-07-13 19:09:37 +02:00
Bartosz Taudul
d2db62ebc3 Change how icons are converted in markdown manual. 2025-07-12 14:25:29 +02:00
Bartosz Taudul
249673660e Remove mouse button images from markdown manual. 2025-07-12 13:41:05 +02:00
Bartosz Taudul
f6f2fa0a0a Fix font awesome icons in markdown manual. 2025-07-12 13:34:22 +02:00
Bartosz Taudul
1e1d9d9a84 Fix \menu, this time properly. 2025-07-12 12:35:37 +02:00
Bartosz Taudul
6058e6ede0 Hackfix section names in markdown manual. 2025-07-12 12:23:48 +02:00
Bartosz Taudul
31815fd45d Remove junk from links in markdown manual. 2025-07-12 11:58:19 +02:00
Bartosz Taudul
87c1200c80 Add shell script for latex to markdown conversion. 2025-07-12 11:50:32 +02:00
Bartosz Taudul
c08364779a Update markdown manual. 2025-07-12 11:50:32 +02:00
Bartosz Taudul
ebc25665bd Update markdown manual. 2025-07-12 11:50:24 +02:00
Bartosz Taudul
2e598ee548 Add tracy manual converted to markdown.
The following command was used:

pandoc --wrap=none --reference-location=block --number-sections -s tracy.tex -o tracy.md

This should be a part of the build process, but that would require pandoc,
which is not something users may have installed.
2025-07-12 11:50:15 +02:00