Connect MCP tools
The Runtype Connect Model Context Protocol (MCP) server (runtype-connect) serves tools for connecting an existing AI agent, analyzing its production traces, and running simulations. It also provides one prompt, connect, which starts the onboarding workflow from get_status.
For a first-time setup, call the tools in this order: get_status, get_setup, check_first_trace, describe_agents and save_business_context, the signal tools, start_baseline_simulation, run_simulation, get_report, and export_change_brief.
For setup instructions using https://mcp.runtype.com/mcp, see Connect your coding agent. Every tool on this page has a matching kebab-case subcommand in the runtype-connect CLI. For CLI commands and flags, see Connect CLI.
Shared behavior
The following conventions apply across the Runtype Connect MCP server:
- Authentication and scopes: the server accepts Runtype API keys in the
Authorizationheader (as a bearer token) and Connect OAuth tokens. A signed-in Connect session can call every tool after you claim the organization, and the tools marked Yes in the Before claim column before. An API key needs the scope matching each tool (such asPRODUCTS:READ,PRODUCTS:WRITE,AGENTS:READ,FLOWS:READ,SIGNALS:READ,SIGNALS:WRITE,SIMULATIONS:READ,SIMULATIONS:WRITE,SIMULATIONS:RUN,DEVICES:EXECUTE, orCONVERSATION_EVENTS:WRITE). - Recommended next step (
next): every successful tool response can include anextobject withtool,cli,args, andwhy.next.cliis the same step as aruntype-connectCLI command.next.argsandnext.clicarry every required argument of the step, with the IDs Runtype knows filled in and a<…>placeholder for each value your coding agent fills from the repository. - Product selection (
productId): most product-scoped tools take an optionalproductId. OmitproductIdwhen your organization has one product. Pass it when your organization has several products. Tools that always requireproductIdstate that requirement. - Response size (
responseFormat): tools that acceptresponseFormattakeconcise(default) ordetailed. - Untrusted trace data: tools that return recorded trace or conversation text (
read_trace,get_run_outline,search_run,read_span_payload,get_span_context,ingest_conversation_event,mine_issues,get_report,evaluate_counterfactuals, andexport_change_brief) wrap that text in<untrusted-data>blocks and include anoticeorcontentNoticefield stating that the wrapped text is data to read, not instructions to follow. Treat the prompt samples inget_agent_profileas recorded data, not instructions. - Unclaimed organizations: an organization created with
init --no-browseris unclaimed until you claim it withnpx @runtypelabs/connect claim, which asks for your email and a six-digit code. For steps, see Claim an unclaimed organization. Tools marked No in the Before claim column return aclaim_requirederror containingclaimUrl,claimCompleteUrl, andclaimDeadlineuntil the organization is claimed. An unclaimed Connect session stops authenticating after the 72-hour claim deadline. - Estimates:
preview_signalandrun_simulationrequire anestimateId, except a signal preview that costs at most $0.01 and that your organization’s credit covers, up to 20 a day within your monthly spend cap. Each estimate lasts 24 hours and starts one preview or run. For Connect credit and spend-approval rules, see Limits and pricing. - Unknown and unavailable tools: the server omits tools that aren’t available on your account from
tools/listand returns an error message if you call one by name. Calling an unknown tool name returns an invalid-params error namingtools/list.
Connect tools
Connect tools check onboarding status, record human decisions, return framework tracing recipes, and verify incoming traces. To connect a repository and create its ingest key, see Connect a repository. The following table summarizes the Connect tools:
get_status
Returns the onboarding status of one connected product, including its stage, recommended next step, open pendingActions, claim state, Connect credit balance, agents, and plan usage. Stages progress in order: traces_pending, traces_need_attention, describe, context_confirm, simulate, review, verify_real_agent, and monitor. The first simulation follows business context directly. After the first report, the stage stays review while the report proposes a change to test. The product reaches monitor when you read a report that has nothing to test, or once you export a change brief. At monitor, the next step offers a custom signal until you save one; nothing waits on it.
Each entry in pendingActions has a kind (confirm_business_context, approve_spend, claim_org, or verify_real_agent), a status (open, resolved, or dismissed), and allowedResolutions (confirm and dismiss for confirm_business_context, approve and dismiss for approve_spend, none for claim_org, and dismiss for verify_real_agent).
get_status accepts this input:
productId: optional connected product ID. When omitted in an organization with several products,candidateslists the available products.
get_status returns productId, product, stage, next, pendingActions, organization (id, claimed, and claimUrl), credit (grantedUsd, spentUsd, and remainingUsd), agents (each with id, name, and lastRunAt), optional planUsage (meters), and optional candidates.
resolve_pending_action
Records a person’s decision on an open pending action returned by get_status. Repeating the same resolution with the same factIds and edits returns alreadyResolved: true. Confirming business context and dismissing actions work before claim. Approving spend (approve) requires a claimed organization. A claim_org action accepts no resolution and closes automatically after the organization is claimed. Facts saved in the meantime stay unconfirmed in a fresh confirm_business_context action.
resolve_pending_action accepts these inputs:
actionId: required pending action ID fromget_status.resolution: required decision:confirm(forconfirm_business_context),approve(forapprove_spend), ordismiss(forconfirm_business_context,approve_spend, orverify_real_agent).factIds: required withconfirmwhen the action lists facts. Contains the IDs of the facts shown to the person.edits: optional corrections accepted only withconfirm, containingchanges([{factId, value}]),additions([{field, value}]), andrejections(fact IDs).estimateId: required withapprove. Contains the estimate ID shown to the person.
The following example confirms a confirm_business_context action and edits, adds, and rejects facts:
Replace the following:
YOUR_ACTION_ID: the pending action ID fromget_status.YOUR_FACT_ID_1andYOUR_FACT_ID_2: the fact IDs listed on that pending action.
resolve_pending_action returns productId, action, and alreadyResolved.
get_setup
Returns how to send traces for a connected product: the OTLP traces URL, environment variable names, environment resource attribute, and instrumentation recipes for supported frameworks. The tool never returns the ingest key because recipes read it from RUNTYPE_INGEST_KEY in .env.
get_setup accepts these inputs:
productId: optional connected product ID.framework: optional framework name (AI SDK,LangGraph,OpenAI Agents SDK,Pydantic AI,Mastra,OpenAI Agents SDK (TypeScript),eve,Flue, orOpenTelemetry GenAI). Withoutframework, the response lists the framework names only, in either format; passframeworkto get a recipe.responseFormat: optionalconcise(default) ordetailed.
get_setup returns productId, responseFormat, otlpUrl, environmentVariables, environmentAttribute, defaultEnvironment, frameworks (each with framework, instrumentation, blocks when you pass framework, and agentPrompt when you also ask for detailed), and hint.
check_first_trace
Waits for a first run and checks the newest development run of up to five agents against eight checks: attribution, content, system_prompt, tool_definitions, tool_io, conversation_id, environment, and optional end_user_id.
check_first_trace accepts these inputs:
productId: optional connected product ID.waitSeconds: optional integer from 0 to 50 (default 30) specifying how long to wait for a run.since: optional ISO 8601 timestamp with offset. Ignores runs and refused exports received before that time (default: last 30 days).
check_first_trace returns productId, status (healthy, degraded, needs_attention, processing, or no_traces), checkedAt, since, waitedMs, checks, agents, agentsOmitted, rejections, processingRuns, heldTraces, and fixPrompt.
Analyze tools
Analyze tools store your agent map and business context, inspect observed profiles and traces, manage signals, and record out-of-band conversation events. For a workflow using get_run_outline, search_run, read_span_payload, and get_span_context on large runs, see Investigate a large run. The following table summarizes the Analyze tools:
describe_agents
Stores the declared map of agents in your codebase as a new version when the map changes, keeping the 50 newest versions. Sending the same map again stores nothing and returns the current version with created: false. Key order and list order don’t trigger a new version. Names match agents already created from traces.
describe_agents enforces the following limits:
describe_agents accepts these inputs:
productId: required connected product ID.agents: required non-empty array of agent entries. Each entry requiresnameand accepts optionalrole,entryPoint,prompt(textand optionalsource),tools(name, optionaldescription,inputSchema,source),handsOffTo,endpoints(optionalstagingUrl,httpEntryPoint, andmcpServerswithnameandurl, with no credentials or headers), andsurfaces(array of channel entries, each withtypeand optionalnote, and any other key is refused).
Accepted surfaces[].type values are chat (a chat window in a website or app), api, mcp, a2a, ag-ui, cli, chrome_extension, email, sms, imessage, whatsapp, telegram, slack, discord, webhook (an agent started by an event), schedule (an agent started on a timer), voice, teams, google_chat, messenger, instagram, rcs, signal, line, and other (any channel not listed).
describe_agents returns productId, version, created, contentHash, createdAt, agents (each with name, agentId, created, and optional endpoints), note, and optional endpointsNote.
save_business_context
Stores drafted business-context facts with their sources and opens a confirm_business_context pending action when new facts are stored. Repeating the same facts adds nothing. A product stores up to 500 facts, including rejected facts.
save_business_context accepts these inputs:
productId: required connected product ID.facts: required array of 1 to 50 fact objects. Each fact requiresfield(product,users,agent_placement,interaction,success_criterion,failure_criterion, orother),value(1 to 4,000 characters), andsource(kind:repo,trace, oruser, plusrefwhenkindisrepoortrace).
save_business_context returns productId, created, unchanged, facts, and pendingAction. When pendingAction is open, next is a resolve_pending_action step that asks one question, which problem the first simulation should test, offering the unconfirmed failure_criterion facts with the first one recommended. The answer confirms only the picked fact.
get_agent_profile
Returns what production traces show for one agent, its 20 newest profile versions, and its declared map entry. It also returns drift, comparing the observed profile against the newest map from describe_agents. Each new profile version includes a model-written reading, which carries a small charge.
In concise mode (default), declared stays under 32 KB (prompt cut to 2,000 characters, at most 20 tools with descriptions cut to 500 characters and no input schemas, and at most 10 hand-offs), counts omitted items in toolsOmitted and handsOffToOmitted, and sets declared.truncated to true. The tool refuses detailed responses larger than 120 KB.
get_agent_profile accepts these inputs:
agent: required agent name (as carried in traces) or agent ID.productId: optional connected product ID.version: optional positive integer profile version to compare (defaults to the newest version).responseFormat: optionalconcise(default) ordetailed.
get_agent_profile returns productId, agent, status (ready or no_production_traces), reason, profile, versions (data and hasMore), drift, declared, and declaredReason. profile summarizes up to 500 recent production runs from the past 14 days (version, windowStart, windowEnd, turnCount, conversationCount, and facts). Inside facts, prompts lists up to 10 system prompts (hashes, run counts, excerpts when contentCaptured is true, and versionDefining: true at 10% or more of runs), tools lists up to 200 tools (call counts, error counts, error rates, and schema hashes), and models lists up to 10 models (provider and call count). Check facts.truncated to see whether runs, prompts, tools, or models reached their limit.
query_traces
Counts a product’s runs grouped by environment and one additional breakdown dimension, with failure rates, durations, and sample execution IDs for read_trace and the run-inspection tools. The default window is the last seven days, up to 30 days (capped at seven days when breakdown is model), bounded by plan retention. When you omit agentId, Runtype counts up to 100 agents per product and adds agents_truncated to warnings if the product has more.
query_traces accepts these inputs:
productId: optional connected product ID.environment: optional environment filter (such asdevelopmentorproduction, ornullfor runs with no environment). Omit to include every environment in separate groups.agentId: optional agent ID filter.status: optional run status filter (running,completed, orfailed).breakdown: optional second grouping dimension (agentdefault,status,day,stop_reason,model, orsource).from: optional ISO 8601 window start (defaults to seven days beforeto).to: optional ISO 8601 window end (defaults to now).limit: optional groups per page, 1 to 50 (default 10 forconcise, 25 fordetailed).cursor: optionalnextCursorvalue from a previous page.responseFormat: optionalconcise(default) ordetailed(addsdurationMsP95,tokens, andcost).
query_traces returns productId, responseFormat, environment, allEnvironments, breakdown, window, groups (each with metrics and sampleExecutionIds), totals (null when allEnvironments is true), truncated, nextCursor, warnings, and hint.
read_trace
Reads one run of a connected product and a window of its spans, wrapping recorded text values in <untrusted-data> blocks. By default, full span content loads for runs outside production and stays off for production runs. Responses larger than 120 KB drop span content (droppedForSize: true) and return a hint for reading smaller slices. For a large or unfamiliar run, start with get_run_outline, find text with search_run, then inspect one span with get_span_context or read_span_payload.
read_trace accepts these inputs:
executionId: required execution ID fromquery_tracesorcheck_first_trace.productId: optional connected product ID.start: optional zero-based first span index. Cannot be combined witharoundFirstFailure.limit: optional span count, 1 to 50 (default 10 forconcise, 25 fordetailed).kind: optional span filter (model,tool, orstep).aroundFirstFailure: optional integer from 0 to 50 returning the first failed span plus that many spans on each side.includeContent: optional boolean overriding whether full input and output load.maxContentBytes: optional content byte budget, 1 to 65,536 (default 16,384 forconcise, 65,536 fordetailed).responseFormat: optionalconcise(default) ordetailed(adds span IDs, timestamps, token counts, cost, and stop reason).
read_trace returns productId, responseFormat, notice, run (executionId, traceId, agentId, agentName, flowId, conversationId, environment, production, startedAt, endedAt), totalSpans, matchedSpans, selection (from, to, and firstFailedIndex when a matched span failed), spans (in start order, each with index, kind, name, toolName, status, durationMs, model, error, inputPreview, outputPreview, and content when loaded), truncated, traceTruncated, content (loaded, usedBytes, limitBytes, droppedForSize, cut, and unavailable), and hint. Setting responseFormat to detailed adds spanId, parentSpanId, startedAt, inputTokens, outputTokens, cost, and stopReason to each span.
get_run_outline
Returns a structural overview of one run without loading full span payloads: totals, span counts by kind, a tool-call histogram, previews of the first and final model call, a shortlist of failed spans, and a flat span outline with nesting depth. Responses larger than 120 KB drop detail and explain what was cut in hint. API key scope: PRODUCTS:READ, plus AGENTS:READ for an agent run or FLOWS:READ for a flow run.
get_run_outline accepts these inputs:
executionId: required execution ID fromquery_tracesorcheck_first_trace.productId: optional connected product ID.previewChars: optional integer from 0 to 400 (default 80 forconcise, 160 fordetailed). Set0to omit previews.maxSpans: optional integer from 1 to 500 (default 100 forconcise, 250 fordetailed).responseFormat: optionalconcise(default) ordetailed.
get_run_outline returns productId, responseFormat, notice, run (same fields as read_trace), totals (totalSpans, durationMs, inputTokens, outputTokens, cost), spanKindCounts, toolCalls (each with toolName, count, errorCount, sampleSpanIndex, sampleInputPreview, sampleOutputPreview), firstModelPreview, finalModelPreview, errorSpans (each with index, spanId, kind, name, toolName, errorPreview), spans (each with index, spanId, parentSpanId, depth, kind, name, toolName, status, durationMs, model, inputTokens, outputTokens, errorPreview, inputPreview, outputPreview), truncated, traceTruncated, and hint.
search_run
Searches inside one run’s spans for literal text or a regular expression and returns each match’s character range and context snippet. By default, full span content loads for runs outside production and stays off for production runs. Responses are capped at 120 KB. API key scope: PRODUCTS:READ, plus AGENTS:READ for an agent run or FLOWS:READ for a flow run.
search_run accepts these inputs:
executionId: required execution ID.pattern: required search string, 1 to 500 characters for literal text or 1 to 200 characters as a regular expression whenregexistrue.productId: optional connected product ID.regex: optional boolean (defaultfalse). Lookarounds, backreferences, Unicode property escapes, and consecutive quantifiers aren’t supported and return HTTP400(INVALID_SEARCH).caseSensitive: optional boolean (defaultfalse).kind: optional span filter (model,tool, orstep).scope: optional array of fields to search (input,output,systemInstructions,toolArguments,toolResult,error, ormetadata). Defaults to every field.contextChars: optional integer from 0 to 300 (default 80) specifying context characters per snippet.maxMatches: optional integer from 1 to 200 (default 50).includeContent: optional boolean overriding whether full stored content is searched.
search_run returns productId, notice, run, pattern, regex, caseSensitive, contentLoaded, searchedSpans, totalSpans, matches (each with spanIndex, spanId, spanName, kind, toolName, scope, range as [start, end], and framed snippet), truncated, traceTruncated, incomplete (true when content for some spans couldn’t load), unresolvedSpanIds, and hint.
read_span_payload
Reads one content field from one span, with optional JSON path selection and character-range paging. By default, full span content loads for runs outside production and stays off for production runs. Responses are capped at 120 KB. An unknown span returns HTTP 404 (SPAN_NOT_FOUND). API key scope: PRODUCTS:READ, plus AGENTS:READ for an agent run or FLOWS:READ for a flow run.
read_span_payload accepts these inputs:
executionId: required execution ID.spanId: required span ID or zero-based span index as a string (fromget_run_outlineorsearch_run).target: required field to read (input,output,systemInstructions,toolArguments, ortoolResult).productId: optional connected product ID.path: optional dot or bracket JSON path, 1 to 500 characters (for example,$.messages[0].content,messages[-1].text, oritems[*].id). Recursive descent (..) isn’t supported. Returns HTTP400(INVALID_PATH) for an invalid path and HTTP404(PATH_NOT_FOUND) when nothing matches.startOffset: optional integer of 0 or greater (default 0) specifying the first character to return.endOffset: optional integer of 1 or greater specifying the character to stop before. Must be greater thanstartOffset.maxChars: optional integer from 1 to 32,000 (default 8,000).includeContent: optional boolean overriding whether full stored content loads.
read_span_payload returns productId, notice, run, span (index, spanId, parentSpanId, kind, name, toolName, status), target, path, format (json or text), framed value (null when empty or not loaded), totalChars, returnedRange, truncated, nextOffset (pass as startOffset to continue reading), contentLoaded, unavailable, and hint.
get_span_context
Returns one span’s outline entry with its direct parent and the sibling spans before and after it in start order, without loading full payloads. Responses are capped at 120 KB. API key scope: PRODUCTS:READ, plus AGENTS:READ for an agent run or FLOWS:READ for a flow run.
get_span_context accepts these inputs:
executionId: required execution ID.spanId: required span ID or zero-based span index as a string.productId: optional connected product ID.before: optional integer from 0 to 20 (default 2) specifying sibling spans before the target.after: optional integer from 0 to 20 (default 2) specifying sibling spans after the target.includeParent: optional boolean (defaulttrue).previewChars: optional integer from 0 to 400 (default 80).
get_span_context returns productId, notice, run, span, parent (or null), before, after (entries use the same fields as spans in get_run_outline), totalSiblings, traceTruncated, and hint.
get_signals
Returns the signal sets that score a product’s agents, enabled bindings, result counts, and monthly signal measurement usage.
get_signals accepts these inputs:
productId: required connected product ID.days: optional integer from 1 to 30 (default 7) specifying how many days of results to count.
get_signals returns productId, agents, signalSets (including boundAgentIds and missingAgentIds), bindings, stats (from, to, and rows split by sample: uniform or filtered), and measurements.
preview_signal
Prices or runs a preview of a named signal on one agent’s recent completed traces without storing results or binding the signal to live traffic. Passing definition saves it as the signal set’s current version without binding it. A preview sent without an estimateId runs at once, without asking, when it costs at most $0.01, your organization’s credit covers it, your organization ran fewer than 20 such previews in the last 24 hours, and it fits your monthly spend cap; the response then carries ranWithoutApproval with what it cost. Any other preview requires an estimateId from calling preview_signal with dryRun: true (or from estimate with subject: "signal_preview") with the same name, agentId, limit, and definition, and otherwise returns ESTIMATE_REQUIRED. Runtype bills the model calls for a preview.
preview_signal accepts these inputs:
productId: required connected product ID.name: required signal set name.agentId: required agent ID from the product.definition: optional signal set definition. Omit to preview the set’s current version.sourceFactIds: optional array of up to 20 confirmed business-context fact IDs for this product.limit: optional trace count, 1 to 50 (default 20).dryRun: optional boolean. Settrueto price the preview and receiveestimate.estimateIdwithout calling a model.estimateId: required to run a preview that costs more than $0.01, that your organization’s credit doesn’t cover, that comes after 20 such previews in 24 hours, or that would pass your monthly spend cap (omit on a dry run).acknowledgeExternalProcessing: optional boolean required after human confirmation when an organization handles protected health information and uses a non-default model.
preview_signal returns productId, signalSet, agentId, estimate (on a dry run), preview (when the preview runs: tracesRead, evaluated, failed, signals, samples, costUsd, projectedMonthlyUsd, monthlyTraceVolume, and notes), ranWithoutApproval (costUsd and message, when the preview ran without asking), and measurements.
save_signal
Creates or updates a custom signal set and binds it to every agent of a connected product (up to 50 agents). Coverage defaults to every turn ({"mode":"all"}). Runtype also scores an extra 5% of turns as an unbiased sample, which counts toward your measurements. Repeating the same definition and sourceFactIds adds no version or binding. Runtype refuses a save with SIGNAL_MEASUREMENT_ALLOWANCE_EXCEEDED when added measurements exceed the remaining monthly allowance. You can’t overwrite built-in signal sets.
save_signal accepts these inputs:
productId: required connected product ID.name: required signal set name.definition: required signal set definition (signalskeyed by lowercasesnake_casenames, up to 64 characters).description: optional description (up to 2,000 characters).sourceFactIds: optional array of up to 20 confirmed business-context fact IDs for this product. Omit to keep current citations, or pass an empty array to clear them. Only yes/no signals citing confirmedfailure_criterionorsuccess_criterionfacts count in prediction comparisons.coverage: optional scoring coverage ({"mode":"all"}or{"mode":"sample","rate":0.2}).dryRun: optional boolean. Settrueto check projected monthly measurements without saving.acknowledgeExternalProcessing: optional boolean for organizations handling protected health information with a non-default model.
save_signal returns productId, dryRun, signalSet, version, coverage, agents (per-agent outcome: created, updated, unchanged, or refused), and measurements.
ingest_conversation_event
Records an out-of-band deterministic product message sent outside an agent turn (such as a transactional SMS receipt, status banner, proactive nudge, or operator handoff). Runtype scores the message for friction on that channel (for example, too long or spam-like) and keeps it so simulations of that channel include it. Returned content and senderName values appear inside <untrusted-data> blocks.
ingest_conversation_event accepts these inputs:
conversationId: required conversation or thread ID, 1 to 255 characters.channel: required channel type. Accepts anysurfaces[].typevalue listed underdescribe_agents(for example,sms,imessage,slack,telegram,email, orchat).content: required message body (up to 32,000 characters).productId: optional connected product ID.agentId: optional agent ID associated with the thread.eventKind: optional event kind (outbound_notificationdefault,proactive_nudge,transactional_receipt,status_banner,operator_handoff, orsystem_notice).direction: optionaloutbound(default) orinbound.senderName: optional sender display name (up to 120 characters).interactivePayload: optional interactive UI payload object.media: optional array of up to 10 media attachment objects (url,contentType, optionalnameandsize).idempotencyKey: optional key, 1 to 255 characters, to deduplicate retries within the conversation.occurredAt: optional ISO 8601 timestamp.deliveryStatus: optional delivery status (sentdefault,pending,delivered,read,failed, orbounced).
ingest_conversation_event returns notice, deduplicated, and event (including id, conversationId, agentId, productId, channel, eventKind, direction, framed content and senderName, deliveryStatus, signalGrade with passed, frictionScore, firedSignals, and reasons, and occurredAt).
mine_issues
Clusters recent production traces where a signal fired into ranked issues, each with a measurable doneCondition and proposed simulation scenarios. Repeating the call updates matching clusters in place without creating duplicates. Each proposed scenario’s openingMessage appears inside an <untrusted-data> block. API key scope: SIMULATIONS:WRITE. For the full workflow and refusal codes, see Find issues in conversations.
mine_issues accepts these inputs:
productId: optional connected product ID.agentId: optional agent ID filter.windowDays: optional integer from 1 to 90 (default 14) specifying the lookback window in days.maxIssues: optional integer from 1 to 25 (default 10) specifying the maximum number of issues to return.
mine_issues returns productId, notice, scannedTraces, and issues (each with id, productId, agentId, clusterKey, title, summary, signalKeys, status (open, improving, resolved, or dismissed), severity (critical, high, medium, or low), occurrenceCount, sampleTraceIds, sampleExecutionIds, sampleConversationIds, doneCondition, proposedScenarios, simulationId, and latestImproveRunId).
Simulate tools
Simulate tools test changes against a simulation copy of your agent (a copy that Runtype builds from production traces and that never calls your live tools) or against a real agent or MCP server. They price, start, and cancel simulation runs, test single-turn mutations on traced model calls, read and share reports, export change briefs, and register test targets. To pair a local relay before registering a local target, see Test against your real agent. The following table summarizes the Simulate tools:
start_baseline_simulation
Prepares a baseline simulation for one connected agent: builds a copy from its production traces (or its development traces while it has none), draws scenarios from its conversations, and prices one run. Without agent, it picks the product’s agent with the most traces and names it in notes. The product’s first simulation starts in this call with no estimate or approval, under a US$2 spending limit, and runId is set; see Connect credit. Calling it again without drawScenarios or runChangedScenarios changes nothing and returns the same estimate while it’s valid; after a run, it keeps that run. When scenarios were added, edited, or removed since the last run that graded conversations (for example with add_simulation_scenarios), a notes entry says what changed. With runChangedScenarios: true, the call then prices a new baseline run on the current scenarios, keeps hand-written scenarios, and clears the last run and its proposals from the baseline as a drawing does; the new run needs the same approval as any later baseline run. With no such change, it returns the last run. When Connect credit covers the run, it needs no approval and Runtype can prepare and start it automatically after 20 production conversations and confirmed business context are ready. runId is then set. Otherwise, Runtype opens an approve_spend pending action for the run.
During a run, the copy answers each tool call from a recorded production call first, or generates an answer from the tool’s schema. Tools without a captured schema aren’t generated, and notes reports which applied. For refusals such as TOOL_DEFINITIONS_MISSING and BASELINE_WAITING_FOR_RECORDINGS, see Troubleshooting. API key scope: SIMULATIONS:RUN.
start_baseline_simulation accepts these inputs:
productId: optional connected product ID.agent: optional agent ID or agent name. When omitted, Runtype selects the agent already copied by a baseline, the product’s only agent, or the first agent with enough production conversations.drawScenarios: optional boolean. Settrueto draw scenarios from production conversations now. Drawing on request uses Connect credit while any remains and your organization has had fewer than 10 credit-paid drawings in the last 24 hours. Otherwise, it charges your organization without an approval step, so your coding agent asks you first. Unchanged production conversations cost nothing and change nothing; after a finished run, the result names that run, and its estimate starts no new baseline run. Drawn scenarios are replaced, hand-written scenarios are kept, and the baseline’s last run and proposals are cleared (the cleared run stays readable by its ID). Until a new run starts,notessays the earlier run’s proposals and change brief are no longer available from the baseline. Returns HTTP409(BASELINE_RUN_ACTIVE) while a run is queued or running, and HTTP402at your spend limit.runChangedScenarios: optional boolean. Settrueto price a new baseline run on the current scenarios when scenarios were added, edited, or removed since the last run that graded conversations. The last run and its proposals are cleared from the baseline as a drawing clears them, and stay readable by run ID. With no such change, the call returns the last run andnotessays so.
start_baseline_simulation returns productId, agentId, copyAgentId, simulationId, scenarios, state (needs_scenarios, awaiting_approval, ready_to_run, running, or finished), credit (grantedUsd, spentUsd, and remainingUsd), estimate (estimateId, expiresAt, expectedUsd, maxSpendUsd, episodes, and coveredByFirstRunGrant, which is true when Connect credit covers the run so it starts without approval), pendingAction, runId, notes, and next, the product’s next step as get_status gives it. After an unchanged re-draw, next is still that step, such as reading the run’s report, the work its proposals need, or the check against the real agent. In an unclaimed organization, the call fails with the claim_required error.
estimate
Prices a proposal run, a target run, an improvement, or a signal preview without starting work or spending money. Pricing the same subject again returns the same estimate while it’s valid. For proposal_run, state is ready when Connect credit covers the run (start it with run_simulation) or awaiting_approval when spend approval is required first. For target_run and improve_run, estimate always opens an approve_spend pending action that a person approves through resolve_pending_action before run_simulation or improve_agent can start. For improve_run, priceUsd is the budget: the most the improvement can spend. API key scope: SIMULATIONS:RUN for proposal_run, target_run, and improve_run, and SIGNALS:WRITE for signal_preview.
estimate accepts these inputs:
subject: required pricing subject:proposal_run,signal_preview,target_run, orimprove_run.runId: required whensubjectisproposal_runorimprove_run. Contains the baseline run ID fromget_report.budgetUsd: optional budget from 1 to 50 (default 10) accepted only whensubjectisimprove_run.trials: optional integer from 2 to 8 (default 3) accepted only whensubjectisproposal_run.targetId: required whensubjectistarget_run. Contains the target ID fromconnect_test_target.productId: required whensubjectissignal_preview. Optional fortarget_run.name: required whensubjectissignal_preview. Contains the signal set name.agentId: required whensubjectissignal_preview. Contains the agent ID.definition: optional signal definition forsignal_preview.sourceFactIds: optional confirmed fact IDs forsignal_preview.limit: optional trace count (1 to 50, default 20) forsignal_preview.
estimate returns subject, estimateId, expiresAt, priceUsd, state (ready, claim_required, awaiting_approval, running, or finished), pendingAction, and the subject-specific detail field (proposalRun, targetRun, improveRun, or signalPreview).
run_simulation
Starts the simulation run priced by an estimateId from start_baseline_simulation or estimate. After the product’s first simulation, any run that Connect credit doesn’t cover requires approving the approve_spend pending action first. Calling run_simulation again with the same estimateId returns the existing run (replayed: true) and charges nothing more.
When your organization already has its maximum number of runs queued or running, the call returns HTTP 429 (SIMULATION_TOO_MANY_RUNNING). When another run is using the Connect credit that this run needs, the call returns HTTP 429 (CONNECT_CREDIT_IN_USE). Call run_simulation again with the same estimateId after the blocking run finishes. If Connect credit no longer covers the run, price the run again. API key scope: SIMULATIONS:RUN.
run_simulation accepts this input:
estimateId: required estimate ID fromstart_baseline_simulationorestimate.
run_simulation returns runId, productId, simulationId, status, and replayed. When replayed is true, note says which run the estimate already started and that nothing new started or was charged.
improve_agent
Finds changes that make an agent pass more of its baseline’s scenarios, inside a budget that a person approved. Each call tests one change against the simulation copy and keeps it only when it passes more scenarios without losing ground on the ones set aside for checking. The improvement stops at the budget, at a 95% pass rate, or when more changes stop helping. Nothing is applied to your real agent: your coding agent makes the kept changes in your agent’s code or configuration.
To start one, call estimate with subject: "improve_run" and the baseline runId, approve the approve_spend pending action, then call improve_agent with the estimateId. Call it again with the same estimateId while state is running. A call can take a few minutes. Before approval, the call returns HTTP 403 (SPEND_NOT_APPROVED). API key scope: SIMULATIONS:RUN.
improve_agent accepts these inputs:
estimateId: required estimate ID fromestimatewithsubject: "improve_run".issueId: optional issue ID frommine_issues, sent on the first call, that records which issue the improvement is for.
improve_agent returns improveRunId, simulationId, state (running or finished), next, and outcome: state (in_progress, improved, no_improvement, or failed), headline (the result in one sentence), whyItStopped, passRateBefore and passRateAfter (measured on the scenarios set aside for checking), recommendedVariantId, recommendedEdits (the kept changes in the order to apply them, each with label, rationale, and change), spentUsd, budgetUsd, and nextAction (advance, apply_changes, or none).
list_runs
Lists a connected product’s simulation runs, newest first, up to 20 runs. For each run, targetKind is copy for a trace-built copy, external_agent for your real agent, or external_mcp for an MCP server. Finished runs have a status of completed, failed, cancelled, or budget_exhausted. When gradedEpisodes is 0, the run has no result and start_baseline_simulation prices a new one. API key scope: SIMULATIONS:READ.
list_runs accepts this input:
productId: optional connected product ID.
list_runs returns productId, runs (each with runId, simulationId, agentId, targetKind, status, episodesPlanned, episodesCompleted, spentUsd, gradedEpisodes, createdAt, and completedAt), and truncated.
cancel_run
Stops a queued or running simulation run and its spend. Runtype keeps episodes that already finished on the run’s partial report. Calling cancel_run on a run that already finished returns HTTP 409 (SIMULATION_RUN_NOT_CANCELLABLE) with the run’s current status. API key scope: SIMULATIONS:RUN. Marked destructive: the CLI asks for confirmation in a terminal and requires --yes otherwise.
cancel_run accepts this input:
runId: required simulation run ID (simrun_prefix, 1 to 255 characters) fromrun_simulationorlist_runs.
cancel_run returns runId and status (usually cancelled).
get_report
Reads a simulation run’s report, including verdict, scores, confidence (replay_verified when the copy matched production conversations, or directional otherwise), up to two proposals, and up to two production predictions. Proposal labels, proposal rationales, proposal changes, and scenario names appear inside <untrusted-data> blocks. The production check and proposals run after the simulation completes, so followUp reads checking until both finish and reads done. When Connect credit covers a proposal run, Runtype starts it automatically after proposals are written, and proposalRunId stores its run ID. When no Connect credit remains after a credit-paid run, notes state that the copy check and proposals didn’t run. API key scope: SIMULATIONS:READ.
get_report accepts these inputs:
runId: optional run ID (defaults to the product’s newest baseline run).productId: optional connected product ID.
get_report returns runId, productId, simulationId, status, cost, target, verdict, toolsNotAnswered, scores, partial, confidence (replay_verified or directional), replayAgreement, replayAgreementRunId, toolAnswers, versionToolAnswers, conversationsCutShort, ungraded, proposals, proposalRunId, recommendation, baselineComparison, followUp (waiting_for_run, checking, or done), predictions, optional predictionsUnavailable, notes, and contentNotice.
Inspect the following fields when acting on a report:
cost: once the run ends, a sentence stating what the run spent against its spending limit and who paid: Connect credit or your organization.nullwhile the run is still running.ungraded: present when no episode could be graded (reason: "no_episode_graded"), withnextStepand acauseslist ordered most common first (includingrecording_missandtool_not_answeredwith affected tools,no_tool_datawhen no tool a conversation called returned data, andscoring_failed).replayAgreement: includes exclusion counts when production conversations couldn’t be replayed:leftOutCallOrderUnknown(production spans lacked readable tool-call order),leftOutCostCeiling(reached the spending limit), andleftOutNotFinished(check stopped early).leftOutcounts every production conversation left out of the check by reason, most first, andsentencenames the largest reason and what would fix it.toolsNotAnswered: present when some conversations called tools the simulation could not answer. The agent got an error or a placeholder in place of an answer, so those conversations are left out ofscores. It lists each tool with its calls and conversations, andnextStepsays how to let a new run answer them.recommendation: on a finished baseline run where no graded conversation failed, says no failure was found in how many conversations and gives one next step.predictions: each metric carriesbeforeandafter(rateandmeasured),delta(after minus before),direction(up,down, orunchangedwhen the absolute difference is under0.005),lowerIsBetter,predictedDirection, andfewMeasurements. Signal metric keys usesignal:KEYfor built-in signals andsignal:SIGNAL_SET_ID:KEYfor custom signals.
evaluate_counterfactuals
Tests 1 to 5 prompt, tool, model, skill, or memory mutations in parallel against the context window of one traced model call. Each evaluation completes within 15 seconds, so you can screen edits before paying for a full multi-turn simulation run. Runtype captures tool calls without calling external tools. When spanId and spanIndex are omitted, Runtype selects the first failed model call, or the model call right before a failed tool call, or the final model call. Recorded trace text, model outputs, tool arguments, and judge reasoning appear inside <untrusted-data> blocks. API key scope: SIMULATIONS:RUN.
evaluate_counterfactuals accepts these inputs:
executionId: required trace execution ID fromquery_tracesorread_trace.candidates: required array of 1 to 5 candidate mutation objects. Each candidate requireslabel(1 to 120 characters) and either at least one entry inmutations(up to 25 mutations) or bothsimulationIdandvariantId. Also accepts optionalid(1 to 120 characters).productId: optional connected product ID.spanId: optional model-call span ID (1 to 255 characters).spanIndex: optional zero-based index in the full trace. The entry at that index must be a model-call span, or the call returns HTTP422.criterion: optional rubric criterion (1 to 4,000 characters) that scores the recorded output and each candidate.assertions: optional deterministic checks with up to 25 entries each inexpectedToolNames,forbiddenToolNames,mustContain(up to 1,000 characters each), andmustNotContain(up to 1,000 characters each).includeSnapshot: optional boolean (defaultfalse). Settrueto include the framed contextsnapshotin the response.timeoutMs: optional integer from 1,000 to 15,000 (default 15,000) specifying the timeout in milliseconds.
Runtype selects each mutation shape in candidates[].mutations by kind and applies the entries in order:
instructions: requiresmode(append,prepend,replace, orpatch). Forappend,prepend, orreplace, passtext(1 to 20,000 characters). Forpatch, omittextand passedits(1 to 20 objects, each withsearchfrom 1 to 4,000 characters andreplaceup to 8,000 characters).tools: accepts optionaladd(up to 50 tool objects withnamefrom 1 to 255 characters, plus optionaldescriptionandinputSchema),remove(up to 50 tool names), andops(up to 20 tool edits). Each entry inopsrequiresopandtool. Supportedopvalues aredescribe(withdescriptionup to 4,000 characters),schema(with optionalpropertiesandrequired), anderror_rewrite(withmatchas{ "code": "NOT_FOUND" }or{ "pattern": "timeout" }, plusmessagefrom 1 to 2,000 characters).model: accepts optionalmodel(1 to 255 characters),temperature(0 to 2), andmaxOutputTokens(positive integer up to 128,000).skill: requiresmode(inject,replace, orremove) andskillSlug(1 to 255 characters). Forinjectorreplace, also accepts optionalcontent(up to 48,000 characters).memory: requiresmode(append,replace,remove, orfilter). Accepts optionalblockId(1 to 255 characters),memoryKind(record,memory,rag, orskill),text(up to 48,000 characters), andexcludeSubstring(1 to 2,000 characters). Whenmodeisremove, passblockId,memoryKind, or both. Whenmodeisfilter, passexcludeSubstring.
The following example tests a prompt append and a model swap against one traced model call:
Replace YOUR_EXECUTION_ID with the trace execution ID from query_traces or read_trace.
evaluate_counterfactuals returns productId, notice, executionId, spanId, spanIndex, contentCaptured, optional snapshot, optional warnings, recordedBaseline (output, deterministicPassed, checkFailures, judge, optional judgeError, and effectiveScore), results (per-candidate id, label, variantId, model, status (completed, timed_out, or failed), durationMs, inputTokens, outputTokens, costUsd, output, deterministicPassed, checkFailures, judge, effectiveScore, improvedOverRecorded, and error), recommendedCandidateId, totalDurationMs, and totalCostUsd.
export_change_brief
Exports one proposed change as a Markdown change brief (up to 20,000 characters, wrapped in <untrusted-data>) with a stable changeId (acb_ prefix) and the runtype.change.id resource attribute marker. The first export records the prediction that get_report compares with production after you ship. Repeating the export changes nothing and spends nothing.
When confidence is replay_verified, you can export any comparable proposal. When confidence is directional, you can export only the proposal that the run picked, and the brief marks the result as promising rather than recommended. When your account can check results against your real agent, the export (or its refusal) offers that check, and get_status lists a verify_real_agent pending action. When the copy’s production check was skipped or couldn’t finish, the export is refused permanently with the reason. API key scope: SIMULATIONS:RUN.
export_change_brief accepts these inputs:
runId: required run ID of the proposal run (evaluation.runIdfromget_report).variant: requiredvariantIdor variant key of the proposal fromget_report.
export_change_brief returns changeId, runId, simulationId, variantId, marker, prediction, brief, truncated, optional comparison, optional predictionNotRecorded, and contentNotice.
share_report
Creates an unlisted, revocable link to a finished simulation run’s report that opens without signing in. In a browser, the link opens as a read-only page. Other clients receive JSON. The link shows the run’s current report (verdict, tasks done or conversations passed, pass rate, cost per success, and what was tested) and omits tool calls. Conversations appear only when include_transcripts is true. The url is returned once and can’t be retrieved later. Marked destructive: the CLI asks for confirmation in a terminal and requires --yes otherwise.
share_report accepts these inputs:
run_id: required simulation run ID (1 to 255 characters).include_transcripts: optional boolean (defaultfalse). Settrueonly when a person asks to include what the simulated user and agent said, as written.expires_in: optional integer from 1 to 365 specifying days until the link stops working. Omit for a link that works until revoked.
share_report returns productId, share_id, url, includes_transcripts, and expires_at (null when the link has no expiration date).
connect_test_target
Registers a callable external agent (reached through the relay or over HTTP) or a relayed local MCP server as a simulation target so a run talks to it instead of a trace-built copy. Calling it again with the same input returns the same target and changes nothing. For kind: "mcp_server", tools marked read-only start live on the first call, every other tool starts simulated, and tools added later start simulated until tools sets their mode. Setting a tool to live sends real calls during a simulation run, so a coding agent asks a person before setting live on any tool. API key scope: SIMULATIONS:WRITE, plus DEVICES:EXECUTE when kind is mcp_server. Marked destructive: the CLI asks for confirmation in a terminal and requires --yes otherwise.
connect_test_target accepts these inputs:
kind: required target kind:agentormcp_server.agentId: required whenkindisagent. Contains the external agent ID fromget_status.deviceId: required whenkindismcp_server. Contains the paired device ID printed byruntype-connect relay --protocol mcp.url: required whenkindismcp_server. Accepts anhttp://127.0.0.1orhttp://[::1]address with no credentials, query string, or fragment.name: optional target name whenkindismcp_serverand the call creates the target.productId: optional connected product ID.tools: optional map of tool names to modes (live,recorded, orsimulated) whenkindismcp_server. The server refuses any tool name not listed by the MCP server withUNKNOWN_TOOL.runId: optional run ID whenkindismcp_serverto list live calls for that run and tool calls across its first 200 conversations.
connect_test_target returns target (id, name, kind set to external_agent or external_mcp, plus agentId or deviceId and url), created, optional agent, optional policies, optional calls (up to 50 live calls), optional runCalls, and next.
Other tools
Other tools search the Connect documentation and report problems with Runtype. The following table summarizes the Other tools:
search_docs
Searches only the Connect documentation pages and returns an answer with cited documentation URLs. When no Connect page covers the question, answer is null and hint says how to continue. The tool cuts answers at 4,000 characters in concise mode (default) or 12,000 characters in detailed mode.
search_docs accepts these inputs:
query: required natural-language question, 1 to 500 characters.responseFormat: optionalconcise(default) ordetailed.
search_docs returns query, responseFormat, answer, sources, truncated, scope, and hint.
submit_feedback
Reports a bug, confusing behavior, or documentation gap with Runtype itself. It’s free, works with any API key, and isn’t for end-user message ratings.
submit_feedback accepts these inputs:
category: required category:api,mcp,documentation,sdk,cli,dashboard, orother.note: required description of what you tried, expected, and observed, 1 to 2,000 characters. Must not include secrets.request_id: optional affected request, execution, or record ID (up to 200 characters).url: optional affected endpoint path or documentation URL (up to 2,048 characters).tool_name: optional MCP tool, SDK method, or CLI command involved (up to 200 characters).
submit_feedback returns id (receipt ID) and status (received).
Next steps
Continue with one of the following pages:
- Connect your coding agent: add the Runtype Connect MCP server and skill to your coding agent.
- Connect CLI: look up every
runtype-connectcommand and option. - Connect a repository: connect a repository, sign up without a browser, and claim an organization.
- Investigate a large run: walk through a long trace with
get_run_outline,search_run,get_span_context, andread_span_payload. - Limits and pricing: check Connect credit, span limits, signal allowances, and trace retention by plan.
- Troubleshooting: resolve refusal codes, trace checks, and connection errors.