Developer Tools · Data & Analytics

Braintrust MCP

Query Braintrust logs with SQL, run evals and evaluators, manage prompts, datasets, dashboards, alerts and Topics automations through Braintrust's hosted MCP server.

Tools

This is a reference catalogue. Tools cannot be configured or run from this page.

  • Sql query

    Run one read-only Braintrust SQL (BTQL) query. Use it directly when the source and fields are known. Pass one complete SELECT in query. Use FROM project_logs('<project_id>'), experiment('<id>'), or dataset('<id>'). Log rows are spans by default. Scope log queries by created (e.g. created >= now() - interval 1 day) or by known IDs. Use is_root = true for root spans and span_attributes.type = 'llm' for model calls. Model usage fields include metrics.prompt_tokens, metrics.completion_tokens, and metrics.estimated_cost. Use infer_schema with specific fields when you need to discover a custom field. Do the filtering, math, grouping, and ranking in SQL. Select only the fields needed for the answer. Set an explicit LIMIT of at most 1000 rows. The default is 10. - Users and sessions: use get_project_settings to find configured identifier fields before grouping project logs by user or session. - Arrays: expand with UNPIVOT (item FOR _ IN (array_expr)). Use json_extract_string(item, '$.key') to read a property from mixed JSON elements. Use a bounded source subquery for large payload fields. - Time buckets: select date_trunc('day', created) AS day and COUNT(*) with GROUP BY day. Use one query for the whole time range. - Percentiles: percentile(value, p) returns an estimate. Pass p between 0 and 1, for example percentile(metrics.end - metrics.start, 0.95) for p95 latency. On data planes with exact percentile support, percentile_disc(value, p) returns the exact nearest rank, and PERCENTILE_CONT(p) WITHIN GROUP (ORDER BY value) interpolates between ranks. - Per-trace totals: GROUP BY root_span_id, then filter totals with HAVING SUM(metrics.estimated_cost) > <amount>. Select root_span_id directly for matching trace IDs. - Per-group ranking: aggregate in subqueries, then rank the complete grouped rows client-side if you need the row associated with each group's maximum. BTQL has no window functions, CTEs, or JOINs. - Rank root spans by elapsed time: on is_root = true, select root_span_id and MAX(metrics.end) - MIN(metrics.start) AS duration, then GROUP BY root_span_id ORDER BY duration DESC LIMIT <n>. This sorts grouped results in SQL. - Cross-span filters: use shape => 'traces' with WHERE ANY_SPAN(<span predicate>) to keep all spans of matching traces available for aggregation. Use SELECT DISTINCT root_span_id to list matching traces and ANY_SPAN(search('keyword')) for full-text search across a trace. To retrieve individual spans, query the matching root_span_id values. Use the lint message to adjust blocked queries. If sort pushdown fails, use ORDER BY created for chronological samples or sort the complete result client-side. To link to a trace, pass root_span_id as row_id to generate_permalink.

  • Summarize experiment

    Get aggregated performance metrics for an experiment, optionally compared to a baseline. Read docs://experiments for background. For row-level data, use sql_query.

PreviousPage 2 / 2