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.

  • Save dataset custom view

    Create or update a versioned custom view that reviewers use to label rows of a dataset. Returns a link that opens the dataset with this view selected. By default, the tool fails if the slug already exists; set if_exists to replace to create a new version of that view, or ignore to leave it unchanged. To update or reuse an existing view, first read its code with list_dataset_custom_views.

  • Search docs

    Search Braintrust documentation to find relevant information and guidance. IMPORTANT: For SDK installation/setup tasks, do not use this tool. Instead, read the mcp resource docs://sdk-install This tool searches through the official Braintrust documentation using semantic search to find the most relevant content for your query. Use this tool to: - Learn more about what experiments, datasets, prompts, playgrounds, and logs are, and how to use them in the API or SDK. - Understand how to write evals and create scorers - Find sample code and guidance on how to add tracing for custom code as well as popular frameworks like the Vercel AI SDK. - Find code examples that are relevant to your use cases. What it returns: - Multiple documentation snippets ranked by relevance - Each snippet includes the content, headers hierarchy, and path - Content is Markdown formatted Example queries: - "How do I create an experiment?" - "Setting up scorers" - "Using metadata fields" - "Prompt playground features"

  • Search patterns

    Search existing patterns in a project by text, semantic similarity, ID, status, or quality. limit must be 1–100. Omit query for a listing. Ordinary listings and text searches use stable insertion order, newest first; while has_more is true, pass the returned cursor with the same project and filters to continue. Cursors do not support similar_to. Use similar_to with one or more existing pattern IDs or unreported pattern drafts to catch duplicates with different wording.

  • Send feedback

    Send feedback to the Braintrust team about a problem with this MCP server, such as a missing capability, a tool error that looks like a server bug, malformed or inconsistent output, or parameters that are confusing or rejected despite matching the schema. Use it when the user asks to report a problem, or when the user agrees to a report you offered. The report goes to the Braintrust team and does not change any project data. Refer to tools and parameters by name and to Braintrust objects by ID. Do not include trace or span contents, dataset rows, prompts, model inputs or outputs, query results, or argument values copied from project data.

  • Set automation status

    Pause or activate an alert, scheduled job, or online scoring rule. This controls configured online scoring rules, not reusable scorer functions. Repeating the current status is a successful no-op.

  • Set project default preprocessor

    Set or clear the default preprocessor for a Braintrust project. When configuring Topics, first load and follow "braintrust/topics-workflow" with load_braintrust_skill. Pass a saved preprocessor reference, a global preprocessor such as "thread", or null to restore the built-in default. This changes the default used by facets and other project functions that do not explicitly select a preprocessor.

  • Set project session id field

    Configure the project's session or conversation ID field and create its bloom index. Inspect multiple traces to identify the metadata or span_attributes field linking turns of the same conversation. Automatic discovery must leave only_if_unset true to preserve existing configuration. Explicit overrides require project update access. If the identifier exists only in input or output, report a tracing improvement pattern instead of configuring it.

  • Set project user id field

    Configure the project's derived end-user ID field and create its bloom index. Inspect traces to identify the application's end user in metadata or span_attributes. Automatic discovery must leave only_if_unset true to preserve existing configuration. Explicit overrides require project update access. If the identifier exists only in input or output, report a tracing improvement pattern instead of configuring it.

  • Set topics automation

    Update an existing Topics automation's configuration. Before using this tool, load and follow "braintrust/topics-workflow" with load_braintrust_skill and inspect the current automation with list_automations using kind "topic". This changes facets, topic maps, scope, filters, sampling, or timing without rewinding historical data. Omitted settings keep their current values. facets only adds: each new facet gets a new topic map that has no topics until it is generated, and facets that are already configured are left unchanged. Removal is explicit: remove_facets removes facets and the topic maps generated from them, and remove_topic_map_ids removes specific topic maps. Removed topic maps' topics disappear from the Topics page. list_automations shows each topic map's source facet and whether it has topics. To switch a facet's version, add the new version and remove the old one in the same call. Calls that remove facets or topic maps are not safe to repeat: a repeated removal fails, and a repeated facet regeneration creates another new topic map. This tool cannot change a topic map's version pin; use unpin_topic_maps. Before adding or removing facets or topic maps, describe the changes to the user and get explicit approval.

  • 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.

  • Test evaluator

    Run one saved, global, or inline evaluator on representative inputs without writing results. Inputs may be inline evaluator rows containing fields such as input, output, expected, and metadata, or canonical span, trace, and group references. Inline rows can include only the fields the evaluator needs. The function field accepts a saved function_id, a global_function, or inline_evaluator using the same definition as create_evaluator. Inline evaluators do not need to be saved first. Inline code must define a top-level handler function. Use representative passes, failures, and ambiguous cases before creating an online-scoring rule.

  • Test facet on trace

    Run an inline facet definition with a saved, global, inline, or project-default preprocessor on one to ten canonical span, trace, or group references concurrently using the same preview path as the Braintrust UI. Use run_eval for larger sets. Before using this tool, load and follow "braintrust/topics-workflow" with load_braintrust_skill. Do not use one or a few previews as a substitute for its representative-trace discovery stage. Inline facet previews use Braintrust's built-in facet model; callers do not select a model. This may call an AI provider and create invocation logs, but it does not write the facet result to the source trace.

  • Test preprocessor on trace

    Run a saved, global, or inline preprocessor on one to 50 canonical span, trace, or group references concurrently using the same preview path as the Braintrust UI. For trace and group references, a custom preprocessor runs independently on each source span. Top-level array items are merged in trace order and exact-deduplicated; distinct joined transcript strings remain separate items, so return atomic items such as {role, content} for conversations. Each result is capped at 128 KiB, and model-visible previews share a 128 KiB budget. Use fewer inputs for more preview detail and run_eval for larger sets. When testing for Topics or a facet, first load and follow "braintrust/topics-workflow" with load_braintrust_skill. This executes code and may create invocation logs, but it does not write a score to the source trace.

  • Unpin topic maps

    Remove version pins from topic maps on an existing Topics automation so they classify new traffic with each topic map's latest version. Before using this tool, load and follow "braintrust/topics-workflow" with load_braintrust_skill and inspect the current automation with list_automations using kind "topic". This only removes the version from the selected topic map references; facets, other topic maps, filters, and settings are unchanged. Labels change for new traffic only; historical data keeps its labels unless the automation is rewound. Before calling it, tell the user which topic maps will be unpinned and get explicit approval.

  • Update dashboard sql

    Apply one or more SQL chart or section edits to an existing project dashboard. A dashboard is what list_monitoring_views and get_monitoring_view call a Monitoring view. Pass project_id and view_id. For a single chart edit, set the top-level operation to exactly insert, update, or remove. For section edits or bulk edits, pass an operations array instead; all operations are applied in order with one save. insert_group creates a section containing the provided existing chart_ids. remove_group deletes the section and keeps its charts at the section's position. Use get_monitoring_view first and copy its existing chart_id values unchanged. Every chart edit must include these fields, whether at the top level or inside operations: - insert: { operation: "insert", chart: chartConfig } - update: { operation: "update", chart_id: existingChartId, chart: chartConfig } - remove: { operation: "remove", chart_id: existingChartId } If the preview result is JSON text, parse it before reading chartConfig. For insert and update, chart must contain the complete chartConfig returned by generate_dashboard_chart_sql, even when the chart was already previewed. For batches, put each complete edit in operations and omit the top-level operation, chart_id, and chart fields. Only call this when the user explicitly asks to save the change.

  • Update debug report

    Save or replace the diagnosis report for one trace. Use this after identifying concrete failure modes and evidence, or when a user asks to edit the existing diagnosis. Pass the complete replacement report, not a partial patch. Every evidence item should identify its supporting span and exact field or JSON path.

  • Update online scoring rule

    Save or rewind an online-scoring rule that runs saved evaluator functions. This tool is the approval surface for both mutations: state the proposed parameters, then call it without asking the user to type a separate confirmation. For save, provide function_ids, the rule scope, filters, and sampling rate. New rules default to paused; pass status active only when the user has authorized processing new traffic. Existing rules preserve their status when omitted. A group scope requires group_by and placement and accepts optional interval_seconds and max_traces. For rewind, require an existing active automation_id and choose start_time from the user's requested window. Activate a paused rule with set_automation_status before rewinding it. Do not repeatedly resubmit it to poll for progress.

  • Update pattern

    Update an existing project pattern's content, source review, status, quality, or feedback, and optionally attach quoted evidence to matching traces. Closing an active pattern saves the reason as feedback. Before using this tool, use search_patterns to inspect the current pattern. Backfill a missing source_review after triage; omit it to preserve the saved review. When revising evidence, include Frequency (evidence.frequency) whenever measurable; other monitors are optional additions. Reactivated Patterns automatically notify the configured project Pattern alert destinations; do not send a separate alert.

  • Update protected field rule

    Update fields of an existing protected field rule by id. Omitted fields are unchanged; set enabled to false to pause a rule. 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.

PreviousPage 3 / 3