mirror of
https://github.com/wolfpld/tracy.git
synced 2026-07-01 11:38:56 +00:00
feat(mcp): expose sections accessor in eval bindings
Bind Worker::GetSections() as get_sections() so the TracySectionEnter /
TracySectionLeave instrumentation added to the client is reachable from
the MCP eval tool's ctx object. Returns a list of {start, end, text}
dicts with nanosecond timestamps, matching the existing list-of-dict
accessor convention. Documented in eval_guide.md.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016EvfzHvUsDBSAwEzTfLTtA
This commit is contained in:
@@ -214,6 +214,20 @@ PYBIND11_MODULE( TracyServerBindings, m )
|
||||
return w.GetMessages().size();
|
||||
} )
|
||||
|
||||
// --- Sections ---
|
||||
.def( "get_sections", []( const Worker& w ) {
|
||||
py::list result;
|
||||
for( auto& s : w.GetSections() )
|
||||
{
|
||||
py::dict d;
|
||||
d["start"] = s.start.Val();
|
||||
d["end"] = s.end.Val();
|
||||
d["text"] = std::string( w.GetString( s.text ) );
|
||||
result.append( d );
|
||||
}
|
||||
return result;
|
||||
} )
|
||||
|
||||
// --- Source locations / zones ---
|
||||
.def( "get_src_loc", []( const Worker& w, int16_t id ) {
|
||||
return w.GetSourceLocation( id );
|
||||
|
||||
Reference in New Issue
Block a user