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.

  • Add to dataset

    Add up to 1000 project log rows to a Braintrust dataset by row ID, like the UI's "Add to dataset", without reading and re-sending their contents. Find candidate rows with sql_query against project_logs, then pass their `id` values. Each copied row keeps the log's input, metadata, and tags, takes its expected value from the log's expected (or output), and links back to the source log via origin. Target an existing dataset by ID or name. Set create_if_missing only when a new named dataset should be created.

  • Add to human review queue

    Add existing project log traces, experiment traces, or dataset rows to Human Review, optionally assigning individual reviewers. Omit experiment_id and dataset_id to target project logs, or provide exactly one to select another source in the project. Marks selected rows PENDING; rejects the entire batch if any row is already COMPLETE, since prior scores cannot represent a new review attempt. Use log_row_ids from sql_query and resolve reviewers with lookup_users. Omit assignee_user_ids to preserve existing reviewers, or pass an empty array to flag without assignment. In Loop automations, enable this write tool explicitly in the automation's tool permissions.

  • Create dashboard sql

    Create a project-scoped dashboard, optionally containing SQL charts that were already previewed with generate_dashboard_chart_sql. A dashboard is what list_monitoring_views and get_monitoring_view call a Monitoring view. Only call this when the user explicitly asks to create or save a dashboard. Pass each returned chartConfig unchanged in the charts array, using a one-element array for a single chart. Pass the preview timeFrame separately as the optional dashboard-level timeFrame; relative presets such as "3d" remain live. Omit timeFrame to use the dashboard default.

  • Create environment update alert

    Create an alert for environment updates. Use config.environment_filter to limit notifications to specific environment slugs, or omit it to match all environments.

  • Create evaluator

    Create a versioned Braintrust LLM or inline code evaluator. Set output_type to score for numeric scores or classification for categorical labels. For an LLM score evaluator, provide choice_scores. For an LLM classification evaluator, provide choices without numeric mappings. By default, the tool fails if the slug already exists; set if_exists to replace to create a new version, or ignore to leave the existing evaluator unchanged.

  • Create facet

    Create a versioned Braintrust facet that extracts structured information from spans or traces. Before using this tool, load and follow "braintrust/topics-workflow" with load_braintrust_skill. Topics and topic-classification requests use that workflow. This is a deployment/promotion tool, not a prompt-testing tool. Develop with inline test_facet_on_trace calls and run_eval experiments first; do not create a facet merely to test a candidate. Facet extraction always uses Braintrust's built-in facet model; callers do not select a model. The project default preprocessor is used when none is provided. By default, the tool fails if the slug already exists; set if_exists to replace to create a new version, or ignore to leave the existing facet unchanged.

  • Create human review score

    Create a native Human Review score definition for a project: categorical choices, a numeric slider, or a free-form text field such as Review notes. Call once per score. Fails if the name already exists.

  • Create log alert

    Create an alert for individual matching project logs. config.btql_filter is a boolean expression, not a SELECT query, and config.interval_seconds throttles repeated notifications without aggregating logs.

  • Create preprocessor

    Create a versioned Braintrust preprocessor from inline JavaScript using the same QuickJS runtime as the Braintrust UI. When the preprocessor is for Topics or a facet, first load and follow "braintrust/topics-workflow" with load_braintrust_skill. By default, the tool fails if the slug already exists; set if_exists to replace to create a new version, or ignore to leave the existing preprocessor unchanged.

  • Create prompt

    Create a versioned Braintrust prompt using the same function representation as project.prompts.create() and bt functions push. Provide either a completion-style prompt or chat messages. By default, the tool fails if the slug already exists; set if_exists to replace to create a new version, or ignore to leave the existing prompt unchanged.

  • Create protected field rule

    Add a protected field rule to a scope's policy, creating the policy if needed. A policy is identified by scope_object_type (organization, project_group_projects, or project), scope_object_id, and restrict_object_type (project_log by default; use dataset for dataset rules). Ingest rules (stage "ingest", action "redact") redact detected entity_types inside field_paths before data is stored. Read rules (stage "read", action "hide") hide field_paths from readers who match protect_when and do not match allow_when. field_paths are arrays of keys or indexes, such as [["input"], ["metadata", "email"]]. protect_when and allow_when are expressions over row, partition, principal, and credential, for example "true", 'principal.user_id in ["<user id>"]', or '"<group id>" in principal.group_ids'. Read rules only support principal.user_id and principal.group_ids conditions.

  • Create scheduled loop job

    Create a custom Loop job that runs on an interval or cron schedule over a recent project-data window. The config must include Loop instructions and cannot include a threshold, so the job runs for every scheduled window. Delivery actions are exposed to Loop as tools.

  • Create threshold alert

    Create a threshold alert for an aggregate over a recent project-data window. Use this for averages, counts, rates, percentages, percentiles, distributions, or other conditions evaluated on a schedule. config.threshold.calculation.btql_query must return at most one row with the numeric or null column named by config.threshold.calculation.output.value_column. Put any minimum sample size in the query, and do not add absolute time bounds because the runtime supplies the evaluation window. Use config.window.evaluation_delay_seconds when ingestion or asynchronous scoring arrives late. config.threshold.policy.pending_seconds controls how long a breach must persist, while renotify_interval_seconds controls reminders.

  • Delete protected field rule

    Delete a protected field rule by id. A policy is identified by scope_object_type (organization, project_group_projects, or project), scope_object_id, and restrict_object_type (project_log by default; use dataset for dataset rules).

  • Edit dataset rows

    Insert, update, or delete up to 1000 Braintrust dataset rows using explicit operations. Target an existing dataset by ID or name. Set create_if_missing only when a new named dataset should be created.

  • Enable topics automation

    Enable Topics for a Braintrust project. Before using this tool, load and follow "braintrust/topics-workflow" with load_braintrust_skill, then inspect existing automations with list_automations using kind "topic". Provide a distinct name to create an additional Topics automation; reusing a name returns the existing automation without changing it. This creates the configured facet topic maps, supports span, trace, or group scope, and defaults new automations to trace scope and the Task facet when omitted. It seeds processing for new traffic but does not rewind historical data.

  • Fail dashboard section

    Report a failure for a precomputed dashboard section using the target and revision from its computation request. Keeps the last successful widgets.

  • Generate dashboard chart sql

    Generate a SQL-backed dashboard chart configuration for visualizing data from project_logs. The chart's query is authored directly as SQL, so it supports aggregates and shapes the structured chart definition cannot express: several percentiles of one field, expressions over multiple metrics, ratios of aggregates, count(distinct ...), and grouping by a time bucket plus another column. WRITING chartSql: - Every non-aggregate column you SELECT must also appear in a GROUP BY. The chart adds the time bucket, but never the GROUP BY — write it yourself. Those columns become the chart's groupings (one series per value); the aggregates are the plotted values. - Use count(1), not count(), to count rows. - For a percentage, rate, share, or proportion, select the raw fraction and set unitType to percent: count(CASE WHEN error IS NOT NULL THEN 1 END) / count(1), or sum(a) / sum(b). The chart multiplies by 100 when it renders, so a leading 100.0 * renders a true 68% as 6612% and a true 0.98 as 9800%. Never multiply by 100 yourself, and expect the selected value to sit between 0 and 1. CHOOSING A DATA SHAPE: - Default to the span shape, which is what project_logs() returns with no shape argument: one row per span. Aggregate over it for anything span-level — counts of LLM calls, per-call latency, token and cost sums. - To measure one span kind, filter in WHERE when every measure in the chart uses that kind: WHERE is_root lets the query skip other spans before reading them. Use a conditional such as avg(CASE WHEN is_root THEN metrics.duration ELSE NULL END) only when measures need different spans, since WHERE drops rows from every measure; a conditional evaluates every span in the time range, which is much slower on large projects. - Trace-level columns exist only on the summary shape, one row per trace: FROM project_logs(shape => 'summary'). These are metrics.llm_calls, metrics.total_tokens, metrics.prompt_tokens, and metrics.estimated_cost — always with the metrics. prefix, since the bare name is not a column. On the default shape they are null. Use summary only when the question is genuinely per-trace, such as end-to-end request latency or tokens per conversation, and expect one row per trace rather than per span. - Use summary sparingly: when the dashboard has any filter applied, the shape is rewritten to 'traces', and the trace-level columns are no longer there. A chart that reads correctly on an unfiltered page can break once a viewer filters it. BY CHART TYPE: - timeseries: return one or more aggregate values plus any non-aggregate groupings; omit the time column and bucket, the chart adds them. SELECT metadata.model AS model, avg(metrics.duration) AS duration FROM project_logs() GROUP BY model - singleValue: return at least one aggregate; only the first is displayed. SELECT count(1) AS spans FROM project_logs() - toplist: return at least one grouping plus the aggregates to rank by; the chart applies the sort and limit. SELECT metadata.model AS model, sum(metrics.tokens) AS tokens FROM project_logs() GROUP BY model - table: return an explicit projection with unique output names; an authored LIMIT is preserved. WHAT THE DASHBOARD ADDS AT RENDER TIME: - The time bucket and time column for timeseries charts. Do not select a time column or bucket yourself. - The timeframe filter, the page's filters, and any page-level group-by. - The project, if you write project_logs() with no argument. Anything you put in WHERE is combined with those, so filter only for what the chart itself needs. Column names vary by project. Inspect the actual columns with infer_schema or a sql_query before writing chartSql rather than assuming a field exists. Then run the chartSql itself with sql_query and read the rows back before generating the chart. Check that the values are the magnitude you expect, that the grouping columns hold real values rather than nulls, and that the row count is plausible. No rows, an all-null column, or a number that is orders of magnitude off means the query is wrong — fix it and re-run rather than charting it. For that check only, add a LIMIT and a time filter so the query stays cheap; the chartSql you submit must not contain either. When creating or editing a chart for a saved dashboard, read get_monitoring_view first and pass its view_id to this tool. Apply that view's saved search filters with its span/trace filter scope to your sql_query validation too, so the checked values and your answer match the preview. Keep dashboard filters out of chartSql.

  • Generate permalink

    Generate a direct web link (permalink) to a Braintrust object for sharing or bookmarking. This tool creates URLs that link directly to projects, experiments, datasets, prompts, functions, or specific log entries in the Braintrust web application. Use this when users want to: - Share a link to an experiment or dataset with teammates - Create bookmarks to specific objects - Generate URLs for external documentation or reports - Navigate directly to specific log entries or traces The tool accepts either object_id directly, or project_name + object_name to resolve the object first. Supply org_name to disambiguate names across organizations. For project_logs, project_patterns, project_prompts, and project_functions, project_name alone is sufficient; object_id must be the containing project UUID. For project_logs, put the root span ID from the query's root_span_id field in row_id, not a child span's id. For patterns, prompts, and scorers, put the resource ID in row_id.

  • Get monitoring view

    Inspect a saved Monitoring view, including its options and ordered chart definitions. Pass view_id: overview to read the built-in Overview's current AI section targets, instructions, artifact paths and publication revision. The built-in Overview is read-only. Copy returned chart_id values unchanged.

Page 1 / 3Next