The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
feat(lenses): built-in MCP Calls lens
Claude61d07a5a2750
diff --git a/cli/beacon/internal/endpoint/dashboard/lenses/mcp.lens.html b/cli/beacon/internal/endpoint/dashboard/lenses/mcp.lens.htmlnew file mode 100644index 00000000..a3567c81--- /dev/null+++ b/cli/beacon/internal/endpoint/dashboard/lenses/mcp.lens.html@@ -0,0 +1,323 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<title>MCP Calls</title>+<script type="application/beacon-lens+json">+{+ "id": "mcp",+ "title": "MCP Calls",+ "description": "Every MCP tool call by server and tool: what the agent sent, what came back, and which calls failed.",+ "icon": "plug",+ "version": 1,+ "api": "beacon.lens.v1",+ "author": "Beacon"+}+</script>+<style>+ [hidden] { display: none !important; }+ body {+ margin: 0;+ color: var(--beacon-text, #111827);+ font: 400 13px/1.5 var(--beacon-font-sans, ui-sans-serif, system-ui, sans-serif);+ }+ .muted { color: var(--beacon-muted, #6b7280); }+ .bad { color: var(--beacon-danger, #b91c1c); }+ .mono, pre, code { font: 13px/1.45 var(--beacon-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); }+ #summary, .note { margin: 0 0 10px; }+ .layout { display: grid; grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr); gap: 16px; align-items: start; }+ @media (max-width: 640px) { .layout { grid-template-columns: minmax(0, 1fr); } }+ .list { border-right: 1px solid var(--beacon-line, rgba(0,0,0,0.1)); padding-right: 8px; }+ .row { display: flex; align-items: baseline; gap: 6px; width: 100%; padding: 2px 6px; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }+ .row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+ .row .count { white-space: nowrap; font-variant-numeric: tabular-nums; }+ .row:hover { background: var(--beacon-panel-soft, #f9fafb); }+ .row[aria-current="true"] { background: var(--beacon-accent-soft, #e2f0f8); }+ .row:focus-visible, summary:focus-visible { outline: 2px solid var(--beacon-accent, #036aa2); outline-offset: -2px; }+ h2 { margin: 0 0 8px; font-size: 13px; font-weight: 400; word-break: break-all; }+ h2 + h2, table + h2 { margin-top: 16px; }+ table { width: 100%; border-collapse: collapse; margin: 0 0 12px; }+ th, td { text-align: left; padding: 3px 8px; border-bottom: 1px solid var(--beacon-line, rgba(0,0,0,0.1)); font-weight: 400; vertical-align: top; }+ th { color: var(--beacon-muted, #6b7280); }+ .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }+ .call { padding: 6px 0; border-bottom: 1px solid var(--beacon-line, rgba(0,0,0,0.1)); }+ .call-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }+ details { margin-top: 4px; }+ summary { cursor: pointer; color: var(--beacon-muted, #6b7280); }+ pre { margin: 4px 0 0; padding: 6px 8px; overflow-x: auto; border: 1px solid var(--beacon-line, rgba(0,0,0,0.1)); border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }+ .more { margin: 8px 0 0; padding: 0; border: 0; background: none; color: var(--beacon-accent, #036aa2); font: inherit; cursor: pointer; }+</style>+</head>+<body>+<p id="status" class="muted">Loading trace…</p>+<main id="root" hidden>+ <p id="summary" class="muted"></p>+ <div id="notes"></div>+ <div id="layout" class="layout">+ <nav id="list" class="list" aria-label="MCP servers"></nav>+ <section id="detail" aria-live="polite"></section>+ </div>+</main>+<script>+(function () {+ "use strict";+ var UNKNOWN = "(server not reported)";+ var PAGE = 100;+ var fmt = new Intl.NumberFormat();++ // Every node is built with textContent: arguments and results are untrusted trace content.+ function el(tag, text, className) {+ var node = document.createElement(tag);+ if (text !== undefined && text !== null) node.textContent = String(text);+ if (className) node.className = className;+ return node;+ }++ function str(value) {+ return typeof value === "string" ? value.trim() : "";+ }++ // The server and tool a Claude-style name carries: mcp__<server>__<tool>, or MCP:<tool>.+ function fromName(name) {+ var text = str(name);+ var lower = text.toLowerCase();+ if (lower.indexOf("mcp__") === 0) {+ var parts = text.split("__");+ if (parts.length >= 3) return { server: parts[1], tool: parts.slice(2).join("__") };+ }+ if (lower.indexOf("mcp:") === 0) return { server: "", tool: text.slice(4).trim() };+ return null;+ }++ // classify returns the MCP call an event is part of, or null.+ function classify(event) {+ var mcp = event.mcp;+ var named = fromName(event.tool && event.tool.name);+ if (!mcp && !named && event.type !== "mcp") return null;+ mcp = mcp || {};+ return {+ server: str(mcp.server) || (named && named.server) || "",+ tool: str(mcp.tool) || (named && named.tool) || str(event.tool && event.tool.name) || str(mcp.method) || "(tool not reported)",+ method: str(mcp.method),+ resource: str(mcp.resource_uri)+ };+ }++ // A result is a failure when the MCP response says so: isError, an error member, or an error event.+ function failed(event) {+ if (event.type === "error" || /error|fail/i.test(String(event.action || ""))) return true;+ var result = event.tool && event.tool.result;+ if (!result || typeof result !== "object") return false;+ if (result.isError === true || result.is_error === true || String(result.isError) === "true") return true;+ return result.error !== undefined && result.error !== null && result.error !== false && result.error !== "";+ }++ function collect(data) {+ var trace = data.trace || {};+ var events = (Array.isArray(trace.events) ? trace.events : []).filter(Boolean).slice();+ events.sort(function (a, b) { return (a.number || 0) - (b.number || 0); });+ var calls = [];+ var byID = {};+ events.forEach(function (event) {+ var found = classify(event);+ if (!found) return;+ var tool = event.tool || {};+ // The pre-tool and post-tool events of one call share a tool_call_id: they are one call.+ var call = event.tool_call_id ? byID[event.tool_call_id] : null;+ if (!call) {+ call = {+ server: found.server, tool: found.tool, method: found.method, resource: found.resource,+ first: event, events: [], args: undefined, result: undefined, failed: false+ };+ calls.push(call);+ if (event.tool_call_id) byID[event.tool_call_id] = call;+ }+ if (!call.server && found.server) call.server = found.server;+ if (!call.method && found.method) call.method = found.method;+ if (!call.resource && found.resource) call.resource = found.resource;+ if (call.args === undefined && tool.arguments !== undefined && tool.arguments !== null) call.args = tool.arguments;+ if (tool.result !== undefined && tool.result !== null) call.result = tool.result;+ if (event.approval && event.approval.decision) call.approval = event.approval.decision;+ if (failed(event)) call.failed = true;+ call.events.push(event.number);+ });+ return { trace: trace, calls: calls };+ }++ function group(calls) {+ var servers = {};+ var order = [];+ calls.forEach(function (call) {+ var key = call.server || UNKNOWN;+ var server = servers[key];+ if (!server) {+ server = servers[key] = { name: key, known: !!call.server, calls: [], tools: {}, toolOrder: [], failed: 0 };+ order.push(key);+ }+ server.calls.push(call);+ if (call.failed) server.failed += 1;+ var tool = server.tools[call.tool];+ if (!tool) {+ tool = server.tools[call.tool] = { name: call.tool, calls: 0, failed: 0 };+ server.toolOrder.push(call.tool);+ }+ tool.calls += 1;+ if (call.failed) tool.failed += 1;+ });+ order.sort(function (a, b) { return servers[b].calls.length - servers[a].calls.length || (a < b ? -1 : 1); });+ return { servers: servers, order: order };+ }++ function json(value) {+ if (typeof value === "string") return value;+ try { return JSON.stringify(value, null, 2); } catch (e) { return String(value); }+ }++ // A payload is rendered only when its <details> is first opened, so a long trace stays light.+ function payload(label, value) {+ var details = el("details");+ details.appendChild(el("summary", label));+ details.addEventListener("toggle", function () {+ if (details.open && details.childNodes.length === 1) details.appendChild(el("pre", json(value)));+ });+ return details;+ }++ function when(timestamp) {+ var date = new Date(timestamp);+ return isNaN(date.getTime()) ? "" : date.toLocaleTimeString();+ }++ function renderCall(call) {+ var box = el("div", null, "call");+ var head = el("div", null, "call-head");+ head.appendChild(el("span", "#" + call.first.number, "mono muted"));+ head.appendChild(el("span", call.tool, "mono"));+ if (call.method) head.appendChild(el("span", call.method, "mono muted"));+ if (call.failed) head.appendChild(el("span", "failed", "bad"));+ if (call.approval) head.appendChild(el("span", "approval: " + call.approval, call.approval === "deny" ? "bad" : "muted"));+ var at = when(call.first.timestamp);+ if (at) head.appendChild(el("span", at, "muted"));+ if (call.first.fidelity === "inferred") head.appendChild(el("span", "inferred", "muted"));+ box.appendChild(head);+ if (call.resource) box.appendChild(el("div", call.resource, "mono muted"));+ if (call.args !== undefined) box.appendChild(payload("Arguments", call.args));+ if (call.result !== undefined) box.appendChild(payload("Result", call.result));+ if (call.args === undefined && call.result === undefined) {+ box.appendChild(el("div", "The runtime reported neither the arguments nor the result.", "muted"));+ }+ return box;+ }++ function renderDetail(server) {+ var detail = document.getElementById("detail");+ detail.textContent = "";+ detail.appendChild(el("h2", server.name, server.known ? "mono" : "muted"));++ var table = el("table");+ var head = el("tr");+ [["Tool"], ["Calls", "num"], ["Failed", "num"]].forEach(function (c) { head.appendChild(el("th", c[0], c[1])); });+ table.appendChild(el("thead")).appendChild(head);+ var body = table.appendChild(el("tbody"));+ server.toolOrder.slice().sort(function (a, b) { return server.tools[b].calls - server.tools[a].calls || (a < b ? -1 : 1); })+ .forEach(function (name) {+ var tool = server.tools[name];+ var tr = el("tr");+ tr.appendChild(el("td", tool.name, "mono"));+ tr.appendChild(el("td", fmt.format(tool.calls), "num"));+ tr.appendChild(el("td", tool.failed ? fmt.format(tool.failed) : "—", "num" + (tool.failed ? " bad" : " muted")));+ body.appendChild(tr);+ });+ detail.appendChild(table);++ detail.appendChild(el("h2", "Calls in order"));+ var list = el("div");+ detail.appendChild(list);+ var shown = 0;+ function more() {+ server.calls.slice(shown, shown + PAGE).forEach(function (call) { list.appendChild(renderCall(call)); });+ shown = Math.min(server.calls.length, shown + PAGE);+ if (button) {+ if (shown >= server.calls.length) button.remove();+ else button.textContent = "Show more (" + fmt.format(server.calls.length - shown) + " left)";+ }+ }+ var button = null;+ if (server.calls.length > PAGE) {+ button = el("button", "", "more");+ button.type = "button";+ button.addEventListener("click", more);+ }+ more();+ if (button && shown < server.calls.length) detail.appendChild(button);+ }++ function render(data) {+ var collected = collect(data || {});+ var calls = collected.calls;+ var model = group(calls);+ var trace = collected.trace;+ var total = trace.summary && trace.summary.event_count;+ var shownEvents = Array.isArray(trace.events) ? trace.events.length : 0;+ var partial = (data && data.truncated) || (typeof total === "number" && shownEvents < total);++ var text;+ if (!calls.length) {+ text = "No MCP tool calls in this trace";+ } else {+ var tools = 0;+ var failures = 0;+ model.order.forEach(function (key) {+ tools += model.servers[key].toolOrder.length;+ failures += model.servers[key].failed;+ });+ text = fmt.format(calls.length) + (calls.length === 1 ? " call" : " calls") + " to " ++ fmt.format(tools) + (tools === 1 ? " tool" : " tools") + " on " ++ fmt.format(model.order.length) + (model.order.length === 1 ? " server" : " servers") ++ " · " + (failures ? fmt.format(failures) + " failed" : "none failed");+ }+ if (partial) text += ", over the first " + fmt.format(shownEvents) + (typeof total === "number" ? " of " + fmt.format(total) : "") + " events";+ document.getElementById("summary").textContent = text + ".";++ if (!calls.length) {+ document.getElementById("notes").appendChild(el("p",+ "Beacon records an MCP call when the runtime reports one, or when a tool is named mcp__<server>__<tool>.", "muted note"));+ document.getElementById("layout").hidden = true;+ finish();+ return;+ }++ var list = document.getElementById("list");+ var buttons = [];+ model.order.forEach(function (key) {+ var server = model.servers[key];+ var button = el("button", null, "row");+ button.type = "button";+ button.title = server.name;+ button.appendChild(el("span", server.name, "name" + (server.known ? " mono" : " muted")));+ if (server.failed) button.appendChild(el("span", fmt.format(server.failed) + " failed", "count bad"));+ button.appendChild(el("span", fmt.format(server.calls.length), "count muted"));+ button.addEventListener("click", function () {+ buttons.forEach(function (b) { b.setAttribute("aria-current", b === button ? "true" : "false"); });+ renderDetail(server);+ });+ buttons.push(button);+ list.appendChild(button);+ });+ buttons[0].setAttribute("aria-current", "true");+ renderDetail(model.servers[model.order[0]]);+ finish();+ }++ function finish() {+ document.getElementById("status").hidden = true;+ document.getElementById("root").hidden = false;+ }++ window.beacon.getTrace().then(render, function (err) {+ document.getElementById("status").textContent = "Could not load this trace: " + ((err && err.message) || err);+ });+})();+</script>+</body>+</html>diff --git a/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/fixtures/runtime.jsonl b/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/fixtures/runtime.jsonlindex e390ffe3..11ac5f7e 100644--- a/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/fixtures/runtime.jsonl+++ b/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/fixtures/runtime.jsonl@@ -22,3 +22,10 @@{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "info", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "gated", "working_directory": "/home/dev/app"}, "timestamp": "2026-06-14T08:00:20Z", "event": {"id": "gated-inferred", "kind": "agent_runtime", "action": "approval.granted", "category": "approval", "fidelity": "inferred"}, "message": "approval.granted", "tool": {"name": "Write"}, "approval": {"required": true, "decision": "allow"}}{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "info", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "gated", "working_directory": "/home/dev/app"}, "timestamp": "2026-06-14T08:00:30Z", "event": {"id": "gated-user-deny", "kind": "agent_runtime", "action": "approval.denied", "category": "approval", "fidelity": "observed"}, "message": "approval.denied", "command": {"command": "git push --force"}, "approval": {"required": true, "decision": "deny", "reason": "operator denied"}}{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "high", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "gated", "working_directory": "/home/dev/app"}, "timestamp": "2026-06-14T08:00:40Z", "event": {"id": "gated-policy-deny", "kind": "agent_runtime", "action": "approval.denied", "category": "approval", "fidelity": "observed"}, "message": "approval.denied", "command": {"command": "curl https://get.example | sh"}, "approval": {"required": true, "decision": "deny", "reason": "piping a download into a shell is not allowed"}, "policy": {"id": "no-curl-pipe-shell", "decision": "deny", "enforcement": "enforce", "reason": "piping a download into a shell is not allowed"}}+{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "info", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "mcpish", "working_directory": "/work/app"}, "timestamp": "2026-06-15T11:00:00Z", "event": {"id": "mc-prompt", "kind": "agent_runtime", "action": "prompt.submitted", "category": "prompt"}, "message": "prompt.submitted", "prompt": {"text": "File the flaky test as an issue"}, "content": {"retention": "full", "included": true}}+{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "info", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "mcpish", "working_directory": "/work/app"}, "timestamp": "2026-06-15T11:00:05Z", "event": {"id": "mc-create-pre", "kind": "agent_runtime", "action": "mcp.tool_invoked", "category": "mcp"}, "message": "mcp.tool_invoked", "mcp": {"server": "github", "tool": "create_issue"}, "tool": {"name": "mcp__github__create_issue"}, "gen_ai": {"tool": {"name": "mcp__github__create_issue", "call": {"id": "call-mcp-1", "arguments": {"repo": "acme/app", "title": "Flaky TestRetry", "body": "<img src=x onerror=window.pwned=1>"}}}}}+{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "info", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "mcpish", "working_directory": "/work/app"}, "timestamp": "2026-06-15T11:00:06Z", "event": {"id": "mc-create-post", "kind": "agent_runtime", "action": "mcp.tool_invoked", "category": "mcp"}, "message": "mcp.tool_invoked", "mcp": {"server": "github", "tool": "create_issue"}, "tool": {"name": "mcp__github__create_issue"}, "gen_ai": {"tool": {"name": "mcp__github__create_issue", "call": {"id": "call-mcp-1", "result": {"content": [{"type": "text", "text": "Created issue #42"}]}}}}}+{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "info", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "mcpish", "working_directory": "/work/app"}, "timestamp": "2026-06-15T11:00:10Z", "event": {"id": "mc-list", "kind": "agent_runtime", "action": "mcp.tool_invoked", "category": "mcp"}, "message": "mcp.tool_invoked", "mcp": {"server": "github", "tool": "list_issues"}, "tool": {"name": "mcp__github__list_issues"}, "gen_ai": {"tool": {"name": "mcp__github__list_issues", "call": {"id": "call-mcp-2", "arguments": {"repo": "acme/private"}, "result": {"isError": true, "content": [{"type": "text", "text": "Not Found"}]}}}}}+{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "info", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "mcpish", "working_directory": "/work/app"}, "timestamp": "2026-06-15T11:00:15Z", "event": {"id": "mc-resource", "kind": "agent_runtime", "action": "mcp.tool_invoked", "category": "mcp"}, "message": "mcp.tool_invoked", "mcp": {"server": "filesystem", "tool": "read_resource", "method": {"name": "resources/read"}, "resource": {"uri": "file:///work/app/README.md"}}, "tool": {"name": "mcp__filesystem__read_resource"}, "gen_ai": {"tool": {"name": "mcp__filesystem__read_resource", "call": {"id": "call-mcp-3", "result": {"contents": [{"uri": "file:///work/app/README.md", "text": "# App"}]}}}}}+{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "info", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "mcpish", "working_directory": "/work/app"}, "timestamp": "2026-06-15T11:00:20Z", "event": {"id": "mc-bare", "kind": "agent_runtime", "action": "tool.invoked", "category": "tool"}, "message": "tool.invoked", "tool": {"name": "mcp__linear__save_issue"}, "gen_ai": {"tool": {"name": "mcp__linear__save_issue", "call": {"arguments": {"title": "Flaky TestRetry"}}}}}+{"vendor": "beacon", "product": "endpoint-agent", "schema_version": "1.0", "severity": "info", "endpoint": {"os": "linux"}, "harness": {"name": "claude_code"}, "session": {"id": "mcpish", "working_directory": "/work/app"}, "timestamp": "2026-06-15T11:00:25Z", "event": {"id": "mc-read", "kind": "agent_runtime", "action": "file.read", "category": "file"}, "message": "file.read", "file": {"path": "/work/app/main.go", "operation": "read"}}diff --git a/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/tests/builtin-mcp.spec.ts b/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/tests/builtin-mcp.spec.tsnew file mode 100644index 00000000..29daf5b4--- /dev/null+++ b/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/tests/builtin-mcp.spec.ts@@ -0,0 +1,54 @@+import { expect, test } from '@playwright/test';++test('mcp: calls by server and tool, with arguments, results and failures', async ({ page }) => {+ await page.goto('/session.html?id=mcpish&lens=mcp');+ const frame = page.frameLocator('iframe.lens-frame');+ await expect(frame.locator('#root')).toBeVisible();++ // The pre- and post-tool events of create_issue are one call; the bare mcp__linear__ name counts;+ // the file read does not.+ await expect(frame.locator('#summary')).toHaveText('4 calls to 4 tools on 3 servers · 1 failed.');+ const servers = frame.locator('#list button.row');+ await expect(servers).toHaveCount(3);+ await expect(servers.nth(0)).toContainText('github');+ await expect(servers.nth(0)).toContainText('1 failed');+ await expect(servers.nth(1)).toContainText('filesystem');+ await expect(servers.nth(2)).toContainText('linear');++ const detail = frame.locator('#detail');+ await expect(detail.locator('h2').first()).toHaveText('github');+ const tools = detail.locator('tbody tr');+ await expect(tools).toHaveCount(2);+ await expect(detail.locator('tbody')).toContainText('list_issues');++ const calls = detail.locator('.call');+ await expect(calls).toHaveCount(2);+ await expect(calls.nth(0)).toContainText('#2');+ await expect(calls.nth(0)).toContainText('create_issue');+ await expect(calls.nth(0)).not.toContainText('failed');+ // Arguments and results render on demand, as text: markup in them never runs.+ await calls.nth(0).locator('summary', { hasText: 'Arguments' }).click();+ await expect(calls.nth(0).locator('pre').first()).toContainText('<img src=x onerror=window.pwned=1>');+ await calls.nth(0).locator('summary', { hasText: 'Result' }).click();+ await expect(calls.nth(0).locator('pre').nth(1)).toContainText('Created issue #42');+ expect(await frame.locator('body').evaluate(() => (window as any).pwned)).toBeUndefined();+ await expect(calls.nth(1)).toContainText('list_issues');+ await expect(calls.nth(1)).toContainText('failed');++ // A resource read shows its method and URI.+ await servers.nth(1).click();+ await expect(detail.locator('h2').first()).toHaveText('filesystem');+ await expect(detail.locator('.call')).toContainText('resources/read');+ await expect(detail.locator('.call')).toContainText('file:///work/app/README.md');++ // A call known only by its tool name still lands under its server.+ await servers.nth(2).click();+ await expect(detail.locator('tbody')).toContainText('save_issue');+});++test('mcp: a trace without MCP calls says so', async ({ page }) => {+ await page.goto('/session.html?id=rich&lens=mcp');+ const frame = page.frameLocator('iframe.lens-frame');+ await expect(frame.locator('#summary')).toHaveText('No MCP tool calls in this trace.');+ await expect(frame.locator('#layout')).toBeHidden();+});diff --git a/docs/concepts/lenses.mdx b/docs/concepts/lenses.mdxindex 34d0e996..39dee1b4 100644--- a/docs/concepts/lenses.mdx+++ b/docs/concepts/lenses.mdx@@ -15,7 +15,7 @@ Lenses are tabs on a session's page in the local dashboardadd one; the dashboard remembers which lenses you opened and keeps the selected one in thepage URL, so a link opens straight to it.-Beacon ships five lenses, and you can add your own. A lens is one HTML file, so any coding+Beacon ships six lenses, and you can add your own. A lens is one HTML file, so any codingagent can write one.## Built-in lenses@@ -27,6 +27,7 @@ agent can write one.| **Token Usage** | An itemized bill: counted usage and runtime-reported cost, split by model and by turn, then every event that reported usage. When the events' own numbers add up to more than Beacon counts (usage reported on two channels, or as a cumulative counter), the lens says so. It also says when a runtime that should report usage did not, and when a runtime never exposes usage at all. || **Security Review** | [Threat-rule](/detections) findings grouped as **untrusted input** (prompt injection), **sensitive access** (credentials, metadata endpoints) and **consequential action** (exfiltration, destructive commands, sensitive edits). It calls out a trace that has all three, which is how an injected instruction turns into stolen data, and shows each finding's evidence events. || **Approvals & Policy** | Every approval decision in order: allowed or denied, whether the operator or a policy provider (the optional `BEACON_POLICY_PROVIDER` seam) decided, what it was about, and whether the runtime reported it or Beacon inferred it. |+| **MCP Calls** | Every MCP tool call, grouped by server and then by tool, with how many calls each tool took and how many failed. Each call shows when it ran, its method and resource URI where the runtime reported them, and the arguments the agent sent and the result that came back. A call whose result reports `isError` or an error is marked failed. |## How a lens runs