@tellagen/mcp-server 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +337 -104
  3. package/SKILL.md +83 -17
  4. package/contracts/mcp-protocol.json +155 -0
  5. package/contracts/runbooks/manifest.json +26 -6
  6. package/contracts/runbooks/v2/cause-lead.guidance.json +37 -0
  7. package/contracts/runbooks/v2/client-protocol.json +926 -0
  8. package/contracts/runbooks/v2/client-writes.guidance.json +42 -0
  9. package/contracts/runbooks/v2/fixtures/timeline-event-blocks-rejected.json +30 -5
  10. package/contracts/runbooks/v2/result-summary.guidance.json +21 -0
  11. package/contracts/runbooks/v2/timeline-event-blocks.schema.json +18 -11
  12. package/contracts/tellagen-runbook-contracts.json +4 -4
  13. package/dist/active-run.d.ts +29 -0
  14. package/dist/active-run.js +67 -0
  15. package/dist/active-run.js.map +1 -0
  16. package/dist/bootstrap.d.ts +20 -0
  17. package/dist/bootstrap.js +29 -0
  18. package/dist/bootstrap.js.map +1 -0
  19. package/dist/cause-lead.d.ts +25 -0
  20. package/dist/cause-lead.js +145 -0
  21. package/dist/cause-lead.js.map +1 -0
  22. package/dist/cli/auth.d.ts +22 -0
  23. package/dist/cli/auth.js +207 -0
  24. package/dist/cli/auth.js.map +1 -0
  25. package/dist/cli/io.d.ts +16 -0
  26. package/dist/cli/io.js +53 -0
  27. package/dist/cli/io.js.map +1 -0
  28. package/dist/cli/listen-guard.d.ts +12 -0
  29. package/dist/cli/listen-guard.js +50 -0
  30. package/dist/cli/listen-guard.js.map +1 -0
  31. package/dist/cli/listen.d.ts +28 -0
  32. package/dist/cli/listen.js +205 -0
  33. package/dist/cli/listen.js.map +1 -0
  34. package/dist/cli/main.d.ts +3 -0
  35. package/dist/cli/main.js +53 -0
  36. package/dist/cli/main.js.map +1 -0
  37. package/dist/cli/trace-hook.d.ts +23 -0
  38. package/dist/cli/trace-hook.js +99 -0
  39. package/dist/cli/trace-hook.js.map +1 -0
  40. package/dist/client.d.ts +92 -6
  41. package/dist/client.js +300 -23
  42. package/dist/client.js.map +1 -1
  43. package/dist/config.d.ts +17 -0
  44. package/dist/config.js +38 -0
  45. package/dist/config.js.map +1 -0
  46. package/dist/credentials.d.ts +120 -0
  47. package/dist/credentials.js +363 -0
  48. package/dist/credentials.js.map +1 -0
  49. package/dist/diagnosis-structure.d.ts +257 -197
  50. package/dist/diagnosis-structure.js +144 -1
  51. package/dist/diagnosis-structure.js.map +1 -1
  52. package/dist/diff-figure.d.ts +56 -0
  53. package/dist/diff-figure.js +276 -0
  54. package/dist/diff-figure.js.map +1 -0
  55. package/dist/errors.d.ts +21 -0
  56. package/dist/errors.js +60 -0
  57. package/dist/errors.js.map +1 -1
  58. package/dist/figures.d.ts +312 -232
  59. package/dist/figures.js +189 -47
  60. package/dist/figures.js.map +1 -1
  61. package/dist/guide-resources.d.ts +28 -0
  62. package/dist/guide-resources.js +81 -0
  63. package/dist/guide-resources.js.map +1 -0
  64. package/dist/heartbeat.d.ts +24 -0
  65. package/dist/heartbeat.js +94 -0
  66. package/dist/heartbeat.js.map +1 -0
  67. package/dist/home.d.ts +8 -0
  68. package/dist/home.js +14 -0
  69. package/dist/home.js.map +1 -0
  70. package/dist/identity.d.ts +32 -0
  71. package/dist/identity.js +83 -0
  72. package/dist/identity.js.map +1 -0
  73. package/dist/index.js +46 -14
  74. package/dist/index.js.map +1 -1
  75. package/dist/listen-config.d.ts +67 -0
  76. package/dist/listen-config.js +83 -0
  77. package/dist/listen-config.js.map +1 -0
  78. package/dist/listen-probe.d.ts +57 -0
  79. package/dist/listen-probe.js +158 -0
  80. package/dist/listen-probe.js.map +1 -0
  81. package/dist/listen-rules.d.ts +88 -0
  82. package/dist/listen-rules.js +252 -0
  83. package/dist/listen-rules.js.map +1 -0
  84. package/dist/listen-settings.d.ts +18 -0
  85. package/dist/listen-settings.js +50 -0
  86. package/dist/listen-settings.js.map +1 -0
  87. package/dist/listen-wrap.d.ts +21 -0
  88. package/dist/listen-wrap.js +52 -0
  89. package/dist/listen-wrap.js.map +1 -0
  90. package/dist/listener.d.ts +195 -0
  91. package/dist/listener.js +600 -0
  92. package/dist/listener.js.map +1 -0
  93. package/dist/open-run.d.ts +2 -0
  94. package/dist/open-run.js +5 -0
  95. package/dist/open-run.js.map +1 -0
  96. package/dist/prompts.d.ts +12 -0
  97. package/dist/prompts.js +37 -0
  98. package/dist/prompts.js.map +1 -0
  99. package/dist/redact.d.ts +13 -0
  100. package/dist/redact.js +76 -0
  101. package/dist/redact.js.map +1 -0
  102. package/dist/run-events.d.ts +54 -0
  103. package/dist/run-events.js +210 -0
  104. package/dist/run-events.js.map +1 -0
  105. package/dist/run-state.d.ts +221 -0
  106. package/dist/run-state.js +221 -0
  107. package/dist/run-state.js.map +1 -0
  108. package/dist/server.d.ts +22 -2
  109. package/dist/server.js +137 -29
  110. package/dist/server.js.map +1 -1
  111. package/dist/session.d.ts +99 -0
  112. package/dist/session.js +187 -0
  113. package/dist/session.js.map +1 -0
  114. package/dist/shell-rules.d.ts +49 -0
  115. package/dist/shell-rules.js +335 -0
  116. package/dist/shell-rules.js.map +1 -0
  117. package/dist/signin-index.d.ts +164 -0
  118. package/dist/signin-index.js +116 -0
  119. package/dist/signin-index.js.map +1 -0
  120. package/dist/signin.d.ts +169 -0
  121. package/dist/signin.js +541 -0
  122. package/dist/signin.js.map +1 -0
  123. package/dist/source-bases.d.ts +75 -0
  124. package/dist/source-bases.js +125 -0
  125. package/dist/source-bases.js.map +1 -0
  126. package/dist/start.d.ts +7 -6
  127. package/dist/start.js +14 -7
  128. package/dist/start.js.map +1 -1
  129. package/dist/tools/catalog.d.ts +44 -0
  130. package/dist/tools/catalog.js +105 -0
  131. package/dist/tools/catalog.js.map +1 -0
  132. package/dist/tools/causes.d.ts +6 -6
  133. package/dist/tools/causes.js +4 -5
  134. package/dist/tools/causes.js.map +1 -1
  135. package/dist/tools/context.js +5 -5
  136. package/dist/tools/context.js.map +1 -1
  137. package/dist/tools/datasources.js +71 -14
  138. package/dist/tools/datasources.js.map +1 -1
  139. package/dist/tools/diagnostics.js +2 -2
  140. package/dist/tools/diagnostics.js.map +1 -1
  141. package/dist/tools/figures.d.ts +3 -2
  142. package/dist/tools/figures.js +38 -13
  143. package/dist/tools/figures.js.map +1 -1
  144. package/dist/tools/findings.d.ts +28 -0
  145. package/dist/tools/findings.js +75 -12
  146. package/dist/tools/findings.js.map +1 -1
  147. package/dist/tools/incidents.js +5 -5
  148. package/dist/tools/incidents.js.map +1 -1
  149. package/dist/tools/index.d.ts +19 -2
  150. package/dist/tools/index.js +115 -14
  151. package/dist/tools/index.js.map +1 -1
  152. package/dist/tools/investigations.d.ts +54 -0
  153. package/dist/tools/investigations.js +372 -68
  154. package/dist/tools/investigations.js.map +1 -1
  155. package/dist/tools/next.d.ts +20 -0
  156. package/dist/tools/next.js +136 -0
  157. package/dist/tools/next.js.map +1 -0
  158. package/dist/tools/postmortem-runbooks.d.ts +52 -52
  159. package/dist/tools/postmortem-runbooks.js +3 -10
  160. package/dist/tools/postmortem-runbooks.js.map +1 -1
  161. package/dist/tools/resume.d.ts +5 -0
  162. package/dist/tools/resume.js +136 -0
  163. package/dist/tools/resume.js.map +1 -0
  164. package/dist/tools/signin.d.ts +12 -0
  165. package/dist/tools/signin.js +54 -0
  166. package/dist/tools/signin.js.map +1 -0
  167. package/dist/tools/source-links.d.ts +16 -0
  168. package/dist/tools/source-links.js +25 -13
  169. package/dist/tools/source-links.js.map +1 -1
  170. package/dist/tools/timeline.js +57 -11
  171. package/dist/tools/timeline.js.map +1 -1
  172. package/dist/trace-record.d.ts +36 -0
  173. package/dist/trace-record.js +283 -0
  174. package/dist/trace-record.js.map +1 -0
  175. package/dist/version.d.ts +10 -2
  176. package/dist/version.js +20 -1
  177. package/dist/version.js.map +1 -1
  178. package/package.json +23 -3
  179. package/server.json +9 -9
  180. package/contracts/runbooks/v1/fixtures/global-runbook.json +0 -7
  181. package/contracts/runbooks/v1/runbook-definition.schema.json +0 -25
  182. package/dist/auth.d.ts +0 -7
  183. package/dist/auth.js +0 -19
  184. package/dist/auth.js.map +0 -1
@@ -1,12 +1,14 @@
1
1
  import { z } from "zod";
2
+ import { activeRunId } from "../active-run.js";
2
3
  import { formatError } from "../errors.js";
4
+ import { chooseGrafanaBase, knownSourceBases, } from "../source-bases.js";
3
5
  const DEFAULT_GRAFANA_ENV_VARS = [
4
6
  "GRAFANA_URL",
5
7
  "GRAFANA_SERVICE_ACCOUNT_TOKEN",
6
8
  ];
7
9
  export function registerDatasourceTools(server, client) {
8
10
  server.registerTool("tellagen_probe_datasource", {
9
- description: "Run a local read-only diagnostic for a Tellagen datasource. For Grafana, checks required local environment variables and calls Grafana /api/health without returning credentials.",
11
+ description: "Check the local setup of a datasource that Tellagen lists, before you query it. For Grafana it checks the required environment variables and calls the /api/health endpoint. Returns ok, the checks that ran, the names of missing environment variables and a recommended action. It is read-only and never returns credentials.",
10
12
  inputSchema: {
11
13
  datasource_id: z
12
14
  .number()
@@ -40,7 +42,7 @@ export function registerDatasourceTools(server, client) {
40
42
  ],
41
43
  };
42
44
  }
43
- const result = await probeDatasource(selected.datasource, timeout_ms ?? 3000);
45
+ const result = await probeDatasource(selected.datasource, timeout_ms ?? 3000, knownSourceBases(client, activeRunId(client)));
44
46
  return {
45
47
  content: [{ type: "text", text: JSON.stringify(result) }],
46
48
  };
@@ -118,8 +120,11 @@ function selectDatasource(datasources, datasourceID, name) {
118
120
  },
119
121
  };
120
122
  }
121
- async function probeDatasource(datasource, timeoutMs) {
123
+ async function probeDatasource(datasource, timeoutMs, pickupBases = []) {
122
124
  const safe = safeDatasource(datasource);
125
+ const isGrafana = datasource.type?.toLowerCase() === "grafana";
126
+ const addresses = isGrafana ? grafanaAddresses(safe, pickupBases) : [];
127
+ const pickupUrl = addresses.find((address) => address.source === "pickup")?.url;
123
128
  const checks = [
124
129
  {
125
130
  name: "metadata_lookup",
@@ -127,7 +132,10 @@ async function probeDatasource(datasource, timeoutMs) {
127
132
  message: "Datasource metadata was found in Tellagen.",
128
133
  },
129
134
  ];
130
- const missingEnvVars = safe.required_env_vars.filter((envVar) => process.env[envVar]?.trim() === undefined || process.env[envVar]?.trim() === "");
135
+ const missingEnvVars = safe.required_env_vars.filter((envVar) =>
136
+ // An address Tellagen sent with the pickup makes GRAFANA_URL optional.
137
+ !(envVar === "GRAFANA_URL" && pickupUrl) &&
138
+ (process.env[envVar]?.trim() === undefined || process.env[envVar]?.trim() === ""));
131
139
  if (missingEnvVars.length > 0) {
132
140
  checks.push({
133
141
  name: "required_env",
@@ -137,6 +145,7 @@ async function probeDatasource(datasource, timeoutMs) {
137
145
  return {
138
146
  ok: false,
139
147
  datasource: safe,
148
+ ...(addresses.length > 0 ? { addresses } : {}),
140
149
  checks,
141
150
  missing_env_vars: missingEnvVars,
142
151
  recommended_action: "Add the missing variables to your MCP client env or shell before starting tellagen-mcp-server.",
@@ -147,7 +156,7 @@ async function probeDatasource(datasource, timeoutMs) {
147
156
  status: "ok",
148
157
  message: "All required local environment variables are present.",
149
158
  });
150
- if (datasource.type?.toLowerCase() !== "grafana") {
159
+ if (!isGrafana) {
151
160
  checks.push({
152
161
  name: "provider_probe",
153
162
  status: "skipped",
@@ -160,12 +169,30 @@ async function probeDatasource(datasource, timeoutMs) {
160
169
  missing_env_vars: [],
161
170
  };
162
171
  }
163
- const grafanaURL = grafanaURLForDatasource(safe);
164
172
  const tokenEnvVar = grafanaTokenEnvVar(safe.required_env_vars);
165
173
  const token = process.env[tokenEnvVar]?.trim();
166
- if (!grafanaURL || !token) {
174
+ // GRAFANA_URL is the only address that gets the local token. A value that is
175
+ // not an http or https address is a setup error, not something to skip.
176
+ const envUrl = process.env.GRAFANA_URL?.trim();
177
+ if (envUrl && !addresses.some((address) => address.source === "GRAFANA_URL")) {
178
+ checks.push({
179
+ name: "grafana_url",
180
+ status: "error",
181
+ message: "GRAFANA_URL is not an http or https address, so nothing was called.",
182
+ });
183
+ return {
184
+ ok: false,
185
+ datasource: safe,
186
+ ...(addresses.length > 0 ? { addresses } : {}),
187
+ checks,
188
+ missing_env_vars: [],
189
+ recommended_action: "Set GRAFANA_URL to an http or https address, or remove it.",
190
+ };
191
+ }
192
+ const target = addresses.find((address) => address.used);
193
+ if (!target || !token) {
167
194
  const missing = [
168
- ...(!grafanaURL ? ["GRAFANA_URL"] : []),
195
+ ...(!target ? ["GRAFANA_URL"] : []),
169
196
  ...(!token ? [tokenEnvVar] : []),
170
197
  ];
171
198
  checks.push({
@@ -176,17 +203,24 @@ async function probeDatasource(datasource, timeoutMs) {
176
203
  return {
177
204
  ok: false,
178
205
  datasource: safe,
206
+ ...(addresses.length > 0 ? { addresses } : {}),
179
207
  checks,
180
208
  missing_env_vars: missing,
181
209
  recommended_action: "Set Grafana URL and service account token in the local MCP client environment.",
182
210
  };
183
211
  }
184
- checks.push(await probeGrafanaHealth(grafanaURL, token, timeoutMs));
212
+ // The token goes only to GRAFANA_URL. An address that Tellagen sent (the
213
+ // pickup or the datasource) is called without it: /api/health needs no sign-in.
214
+ checks.push(await probeGrafanaHealth(target.url, target.token_sent ? token : undefined, timeoutMs));
185
215
  return {
186
216
  ok: checks.every((check) => check.status === "ok" || check.status === "skipped"),
187
217
  datasource: safe,
218
+ ...(addresses.length > 0 ? { addresses } : {}),
188
219
  checks,
189
220
  missing_env_vars: [],
221
+ ...(target.token_sent
222
+ ? {}
223
+ : { recommended_action: "Set GRAFANA_URL to check the service account token against your own Grafana." }),
190
224
  };
191
225
  }
192
226
  async function probeGrafanaHealth(grafanaURL, token, timeoutMs) {
@@ -198,7 +232,7 @@ async function probeGrafanaHealth(grafanaURL, token, timeoutMs) {
198
232
  method: "GET",
199
233
  headers: {
200
234
  Accept: "application/json",
201
- Authorization: `Bearer ${token}`,
235
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
202
236
  },
203
237
  signal: controller.signal,
204
238
  });
@@ -206,7 +240,9 @@ async function probeGrafanaHealth(grafanaURL, token, timeoutMs) {
206
240
  return {
207
241
  name: "grafana_health",
208
242
  status: "ok",
209
- message: "Grafana /api/health responded successfully.",
243
+ message: token
244
+ ? "Grafana /api/health responded successfully."
245
+ : "Grafana /api/health responded successfully at the address Tellagen sent. No token was sent to it, so the token was not checked.",
210
246
  http_status: response.status,
211
247
  };
212
248
  }
@@ -263,9 +299,30 @@ function requiredEnvVarsForDatasource(datasource, config) {
263
299
  }
264
300
  return [];
265
301
  }
266
- function grafanaURLForDatasource(datasource) {
267
- const envURL = process.env.GRAFANA_URL?.trim();
268
- return envURL || datasource.base_url;
302
+ /**
303
+ * The addresses of a Grafana datasource and where each came from, listed in the
304
+ * order links use them: the pickup `source_bases`, GRAFANA_URL, then the
305
+ * datasource `base_url`. The probe calls GRAFANA_URL when it is valid, else the
306
+ * first address Tellagen sent. Only GRAFANA_URL gets the local token.
307
+ */
308
+ function grafanaAddresses(datasource, pickupBases) {
309
+ const found = [
310
+ { source: "pickup", url: safeURL(pickupBaseFor(datasource, pickupBases)?.base_url) },
311
+ { source: "GRAFANA_URL", url: safeURL(process.env.GRAFANA_URL?.trim()) },
312
+ { source: "datasource", url: datasource.base_url },
313
+ ];
314
+ const known = found.filter((item) => Boolean(item.url) && /^https?:\/\//i.test(item.url));
315
+ const usedSource = known.some((item) => item.source === "GRAFANA_URL") ? "GRAFANA_URL" : known[0]?.source;
316
+ return known.map((item) => ({
317
+ ...item,
318
+ used: item.source === usedSource,
319
+ token_sent: item.source === "GRAFANA_URL" && item.source === usedSource,
320
+ }));
321
+ }
322
+ /** The pickup base of this datasource: the one with its name, else the only Grafana base. */
323
+ function pickupBaseFor(datasource, bases) {
324
+ const named = datasource.name ? chooseGrafanaBase(bases, datasource.name).base : undefined;
325
+ return named ?? chooseGrafanaBase(bases).base;
269
326
  }
270
327
  function grafanaTokenEnvVar(requiredEnvVars) {
271
328
  return (requiredEnvVars.find((envVar) => /(^|_)(TOKEN|API_KEY|PASSWORD|SECRET)(_|$)/i.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AS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
@@ -53,7 +53,7 @@ const diagnosticReportSchema = z.object({
53
53
  });
54
54
  export function registerDiagnosticTools(server, client) {
55
55
  server.registerTool("tellagen_get_diagnostic_session", {
56
- description: "Read a Tellagen MCP diagnostic session. Use this for diag_* IDs; do not pass diag_* IDs to investigation-run tools.",
56
+ description: "Read an MCP diagnostic session by its diag_* ID. Use it only for diag_* IDs; investigation-run tools reject them. To send the result of your check, call tellagen_report_diagnostic_tools. It changes nothing.",
57
57
  inputSchema: {
58
58
  diagnostic_session_id: z
59
59
  .string()
@@ -75,7 +75,7 @@ export function registerDiagnosticTools(server, client) {
75
75
  }
76
76
  });
77
77
  server.registerTool("tellagen_report_diagnostic_tools", {
78
- description: "Post sanitized MCP tool availability and access reports to a Tellagen diagnostic session after the local LLM checks visible MCP tools.",
78
+ description: "Report which MCP tools are visible and usable to a diagnostic session (diag_* ID), after you have checked them. Send only sanitized names and access results, never credentials. It does not start or change an investigation run.",
79
79
  inputSchema: {
80
80
  diagnostic_session_id: z
81
81
  .string()
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../src/tools/diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IAChC,IAAI;IACJ,cAAc;IACd,cAAc;IACd,eAAe;IACf,aAAa;IACb,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC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,WAAW,EAAE,UAAU;KACxB,CAAC;AACJ,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { TellagenClient } from "../client.js";
2
3
  export declare const FIGURE_GUIDE_URI = "resource://tellagen/figure-guide";
3
4
  /** Added to the server instructions so every agent knows figures exist. */
4
5
  export declare const FIGURE_INSTRUCTIONS = "Figures: Tellagen draws typed widgets (stats, compare, trend, table, checks, changes, range_overlap, histogram, run_history, diff) from data you send, in the Diagnosis tab, on the timeline and in the postmortem. Use tellagen_build_figure to turn the numbers you read from a tool result into a figure Tellagen accepts: it puts a time series on an even grid of at most 500 points, turns deploy, alert and rollback times into marks, turns cumulative histogram buckets into bucket counts, maps a GitHub Actions run list to a run history, and enforces every limit. Attach the result as a causal step's figure or as a block on a timeline event. A figure owns its numbers: never repeat them in prose, never invent one, and keep units in the unit field. Read resource://tellagen/figure-guide to choose the widget that fits the question and to learn how to plot data on it.";
5
- export declare const FIGURE_GUIDE = "# Tellagen figures\n\nA figure is a small typed widget that Tellagen draws for you. You send the data. Tellagen draws it the same way in the Diagnosis tab, on the timeline and in the postmortem, and a responder can pin one from one place to another.\n\nUse tellagen_build_figure to make one. It reshapes the numbers you already read from a tool result and checks them against Tellagen's limits before you send anything. It has no data of its own.\n\n## Rules every figure follows\n\n1. A figure owns its numbers. The sentence next to it says what happened and why. It does not repeat the numbers.\n2. Never invent a number. Every value comes from a tool result you can cite. If you do not have the value, leave that row, figure or block out.\n3. Units go in the unit field, once. Do not put them inside a number, and do not repeat them in every label.\n4. One figure per causal step, under the step it proves. A step with no good figure carries none.\n5. Say where the data came from. A trend carries its query in source. For other figures, cite the tool result in the step's evidence refs.\n6. A tone is a meaning, not emphasis: good for healthy or recovered, warn for needs attention, bad for failing, neutral for a plain fact.\n7. The limits below are enforced. A figure over a limit is rejected with the field named. Shorten the data yourself. Do not expect it to be trimmed.\n\n## Pick the widget by the question\n\n| The question | Widget | Step figure | Timeline block | Limits |\n| --- | --- | --- | --- | --- |\n| What are the few numbers that matter? | stats | yes | yes | 1 to 4 items, label 48, value 32, caption 64 |\n| Did it get better, and is it inside the line? | compare | yes | yes | 1 to 8 rows, 3 details per row |\n| When did it start, and what happened around then? | trend | yes | yes | 2 to 500 points, 3 marks |\n| Which items rank highest? | table | no | yes | 1 to 6 columns, 1 to 12 rows, cell 64 |\n| Which checks passed, failed or did not run? | checks | yes | yes | 1 to 12 items, label 80, detail 160 |\n| What moved from one thing to another? | changes | no | yes | 1 to 8 rows, from and to 80, note 160 |\n| Where do two or more ranges meet? | range_overlap | yes | yes | 2 to 4 rows, label 80, unit 12 |\n| Did the slow tail move, when the average did not? | histogram | yes | yes | 3 to 61 edges (2 to 60 buckets), one count per bucket |\n| Which build broke, and which fixed it? | run_history | yes | yes | 2 to 30 runs, 4 marks, ref 80, sha 64, job 80, url 500 |\n| What exactly changed in the code? | diff | yes | yes | path 200, ref 64, 1 to 6 hunks, 12 lines in all, line 160 |\n\n## How to plot data on each widget\n\n### compare: before and after\n\nUse it for a value measured before and after a deploy, rollback, fix or config change. One row per host, route, query or job, biggest movers first.\n\n1. Pick two windows of the same length, one before the change and one after. Run the same query on both.\n2. Take one number per row from each window, for example the p95 over the window.\n3. Set unit once. Set better to lower or higher. Add a threshold for the SLO or alert line.\n\n { \"type\": \"compare\", \"title\": \"p95 latency by route\", \"unit\": \"ms\", \"better\": \"lower\",\n \"threshold\": { \"value\": 500, \"label\": \"SLO 500 ms\" },\n \"rows\": [ { \"label\": \"POST /checkout\", \"before\": 180, \"after\": 640 },\n { \"label\": \"GET /cart\", \"before\": 95, \"after\": 110 } ] }\n\nA distribution is a compare of percentiles: use p50, p95 and p99 as rows, with the SLO as the threshold.\n\n### trend: a series over time\n\nUse it when the evidence is how a value moved. Send the raw samples as points and the times of the events that explain the shape as events.\n\n1. Run a range query. Keep the time and the value of every sample.\n2. Send them as points with t and v. t is an ISO time or Unix time in seconds or milliseconds. v may be a numeric string, as Prometheus returns it. A null or NaN is skipped.\n3. Tellagen puts the points on an even grid of at most max_points (default 240, most 500) and sets start and step_seconds. Samples that share a step combine with reduce. Use max for error rate and latency so a spike survives, mean for a smooth rate.\n4. Add up to three events: a deploy, an alert, a rollback. They become marks at the right index. An event outside the range is left out and reported.\n5. Fill source with kind, datasource, query and step.\n\n { \"type\": \"trend\", \"title\": \"5xx share of requests\", \"unit\": \"%\", \"reduce\": \"max\",\n \"points\": [ { \"t\": \"2026-11-02T14:00:00Z\", \"v\": \"0.24\" }, { \"t\": \"2026-11-02T14:01:00Z\", \"v\": \"0.27\" } ],\n \"events\": [ { \"at\": \"2026-11-02T14:42:00Z\", \"label\": \"Deploy\" }, { \"at\": \"2026-11-02T15:28:00Z\", \"label\": \"Rollback\" } ],\n \"threshold\": { \"value\": 1, \"label\": \"SLO 1%\" },\n \"source\": { \"kind\": \"promql\", \"datasource\": \"prometheus\", \"query\": \"sum(rate(...))\", \"step\": \"1m\" } }\n\nIf the values are already on an even grid, send series with start and step_seconds, and marks by index. Empty steps are filled with a straight line and reported, so say so in the step when it matters.\n\n### stats: the few numbers that matter\n\nUp to four. Each has a short label, a value, a caption that says what it is measured on, and a tone.\n\n { \"type\": \"stats\", \"items\": [ { \"label\": \"Failed e2e tests\", \"value\": \"1 of 121\", \"caption\": \"master, Oct 30\", \"tone\": \"bad\" } ] }\n\n### table: a ranked list\n\nTop queries, failing routes, slowest endpoints. Give columns, then one cell per column in every row. Numbers are written as text. Keep each cell under 64 characters.\n\n### checks: pass or fail per check\n\nA recovery checklist or a CI job list. Put failures first. The block holds 12 items, so for a larger list send every failure and the checks that matter, and give the counts of the rest in the step.\n\n { \"type\": \"checks\", \"title\": \"Jobs on run 41289327533\",\n \"items\": [ { \"label\": \"Frontend Tests\", \"state\": \"fail\", \"detail\": \"1 failed of 13516\" }, { \"label\": \"E2E Tests\", \"state\": \"pass\" } ] }\n\n### changes: a value that moved\n\nA setting, a version, a limit. Each row has a label and a from, a to, or both, with an optional note.\n\n### range_overlap: ranges that meet\n\nUse it when the cause is two ranges meeting: layout offsets, a maintenance window against an error spike, memory or port ranges. Two to four rows, each with a label, a from and a to (from not above to), all in one unit.\n\n1. Read each range from a tool result: the config, the layout, the window times as numbers.\n2. Send min and max for the whole range when you want an overview strip, and every row must fall inside them. Leave out window: Tellagen zooms to the overlap.\n3. Never send the overlap itself. Tellagen computes it, and the builder tells you what it is in summary.\n\n { \"type\": \"range_overlap\", \"title\": \"Header and sticky bar\", \"unit\": \"px\",\n \"rows\": [ { \"label\": \"Header\", \"from\": 0, \"to\": 153 }, { \"label\": \"Sticky bar\", \"from\": 149, \"to\": 197 } ] }\n\n### histogram: a distribution before and after\n\nUse it when an average hides a slow tail. Send bucket counts for two equal windows. Tellagen computes p50, p95, p99 and the share over the threshold from the buckets, so never send percentiles.\n\n1. Run the bucket query on a window before the change and on one of the same length after it, for example sum by (le) (increase(http_request_duration_seconds_bucket{service=\"checkout\"}[30m])) at the end of each window.\n2. Send the result as buckets: one entry per le with the cumulative before and after counts, as Prometheus returns them, numeric strings and \"+Inf\" included.\n3. The builder turns them into edges (lower_edge, default 0, then every finite le) and one count per bucket. Observations above the last finite le have no bucket: the builder rejects them unless you set overflow to drop, and then you say so in the step.\n4. Add the SLO as threshold, in the unit of the le values.\n\n { \"type\": \"histogram\", \"title\": \"Checkout latency\", \"unit\": \"s\",\n \"buckets\": [ { \"le\": \"0.1\", \"before\": \"820\", \"after\": \"610\" }, { \"le\": \"0.5\", \"before\": \"990\", \"after\": \"800\" },\n { \"le\": \"1\", \"before\": \"1000\", \"after\": \"940\" }, { \"le\": \"+Inf\", \"before\": \"1000\", \"after\": \"940\" } ],\n \"threshold\": { \"value\": 0.5, \"label\": \"SLO 500 ms\" } }\n\nIf you already have per-bucket counts, send edges, before and after instead: before and after hold exactly one count per bucket (one fewer than edges), none negative.\n\n### run_history: CI builds, jobs, canaries or deploys\n\nUse it for a regression in CI or a bad deploy. Runs go oldest first, each with a ref, a result (success, failure, cancelled, pending), and the failing job when one failed.\n\n1. List the workflow runs of the branch around the failure: the GitHub Actions REST list, the GitHub MCP list of workflow runs, or gh run list --json number,databaseId,headSha,conclusion,status,createdAt,startedAt,event,url.\n2. Send them as github_runs, as they came. The builder maps each run: ref #run_number, the head sha, the start time, the event as trigger, the run page as url, and the conclusion as result (timed_out and startup_failure count as failure). A run whose conclusion is skipped, neutral, stale or action_required has no result: leave it out or send runs yourself. Runs are put oldest first by time.\n3. Add job to the failing runs: the name of the job that failed, from the run's jobs list.\n4. Add marks for the change that broke it (change_ref regression) and the one that fixed it (fix). Give the sha of the change and the builder places the mark before the first run built from it, or give between with the refs of the two neighbouring runs. change_ref may be a change_refs role: regression_source and first_bad become regression, fix stays fix, others become change.\n5. Set repo to owner/name so each run links to its page, and an optional span such as { \"from\": \"#4151\", \"to\": \"#4163\", \"label\": \"E2E Tests failed\" }.\n\n { \"type\": \"run_history\", \"title\": \"E2E on master\", \"repo\": \"acme/shop\", \"branch\": \"master\",\n \"github_runs\": [ { \"run_number\": 4150, \"head_sha\": \"9f2c1e0\", \"conclusion\": \"success\", \"created_at\": \"2026-10-30T08:00:00Z\", \"event\": \"push\" },\n { \"run_number\": 4151, \"head_sha\": \"4b7a2d1\", \"conclusion\": \"failure\", \"created_at\": \"2026-10-30T09:00:00Z\", \"event\": \"push\", \"job\": \"E2E Tests\" } ],\n \"marks\": [ { \"sha\": \"4b7a2d1\", \"change_ref\": \"regression\", \"title\": \"Move the header to a sticky layout\" } ] }\n\n### diff: the change that broke or fixed it\n\nUse it for the lines that matter in the change, not the whole diff.\n\n1. Read the commit or pull request file from GitHub. additions and deletions are the size of the whole change, from the commit or the pull request, never counted by you from a part of it.\n2. Send the file's patch as patch: the builder keeps its + and - lines, one hunk per @@ header. It must have at most 12 such lines in at most 6 hunks; otherwise copy the lines that show the change into hunks yourself, as they are, indentation kept.\n3. Set path, ref (the commit sha) and repo.\n\n { \"type\": \"diff\", \"path\": \"web/components/Header.tsx\", \"repo\": \"acme/shop\", \"ref\": \"4b7a2d1\", \"additions\": 14, \"deletions\": 3,\n \"hunks\": [ [ { \"op\": \"-\", \"text\": \" position: static;\" }, { \"op\": \"+\", \"text\": \" position: sticky;\" } ] ] }\n\n## Where the figure goes\n\n- A causal step: set it as figure on the step in result_summary.causal_paths. Every type except table and changes is allowed there, at most 16 KB. This needs the diagnosis structure, which the pickup advertises as diagnosis_structure_v1. A Tellagen that does not know a figure type yet drops the figure and says so in the completion warnings (figure_invalid).\n- A timeline event: put it in blocks on tellagen_post_timeline_event or tellagen_update_timeline_event. Any type is allowed, up to 12 per event. An update replaces the whole array, so send every block you want to keep, and [] clears them. Set slot to summary to draw the block above the note, or anchor to the exact heading text it sits under. Not both. Set postmortem to false to keep a block out of the postmortem.\n\nCall tellagen_build_figure with placement step_figure or timeline_block, and use the block it returns as it is.\n\n## Getting the data from other servers\n\n- Grafana or Prometheus: a range query returns time and value pairs. Send them as points. Run the same query on two equal windows for a compare.\n- Loki: a count over time by step is a trend. A count by label over two windows is a compare.\n- Prometheus histograms: the _bucket series summed by le over two equal windows are a histogram. Send them as buckets.\n- GitHub Actions: failed jobs of one run go in checks, failures first. The runs of a branch are a run_history: send the run list as github_runs.\n- GitHub commits and pull requests: the lines that broke or fixed it are a diff. Send the file's patch, and the change's additions and deletions.\n- Kubernetes: restarts or ready counts before and after are a compare, a list of pods is a table.\n\n## If Tellagen rejects a figure\n\nThe builder names the field. For a timeline block the API answers 400 invalid_block with field and details.errors. Fix exactly those fields and send once more. Do not drop a figure to get past an error unless the data in it is not real.\n";
6
- export declare function registerFigureTools(server: McpServer): void;
6
+ export declare const FIGURE_GUIDE = "# Tellagen figures\n\nA figure is a small typed widget that Tellagen draws for you. You send the data. Tellagen draws it the same way in the Diagnosis tab, on the timeline and in the postmortem, and a responder can pin one from one place to another.\n\nUse tellagen_build_figure to make one. It reshapes the numbers you already read from a tool result and checks them against Tellagen's limits before you send anything. It has no data of its own.\n\n## Rules every figure follows\n\n1. A figure owns its numbers. The sentence next to it says what happened and why. It does not repeat the numbers.\n2. Never invent a number. Every value comes from a tool result you can cite. If you do not have the value, leave that row, figure or block out.\n3. Units go in the unit field, once. Do not put them inside a number, and do not repeat them in every label.\n4. One figure per causal step, under the step it proves. A step with no good figure carries none.\n5. Say where the data came from. A trend carries its query in source. For other figures, cite the tool result in the step's evidence refs.\n6. A tone is a meaning, not emphasis: good for healthy or recovered, warn for needs attention, bad for failing, neutral for a plain fact.\n7. The limits below are enforced. A figure over a limit is rejected with the field named. Shorten the data yourself. Do not expect it to be trimmed.\n\n## Pick the widget by the question\n\n| The question | Widget | Step figure | Timeline block | Limits |\n| --- | --- | --- | --- | --- |\n| What are the few numbers that matter? | stats | yes | yes | 1 to 8 items (4 or fewer is best), title 80, label 48, value 32, caption 64 |\n| Did it get better, and is it inside the line? | compare | yes | yes | 1 to 8 rows, 3 details per row |\n| When did it start, and what happened around then? | trend | yes | yes | 2 to 500 points, 3 marks |\n| Which items rank highest? | table | no | yes | 1 to 6 columns, 1 to 12 rows, cell 64 |\n| Which checks passed, failed or did not run? | checks | yes | yes | 1 to 12 items, label 80, detail 160 |\n| What moved from one thing to another? | changes | no | yes | 1 to 8 rows, from and to 80, note 160 |\n| Where do two or more ranges meet? | range_overlap | yes | yes | 2 to 4 rows, label 80, unit 12 |\n| Did the slow tail move, when the average did not? | histogram | yes | yes | 3 to 61 edges (2 to 60 buckets), one count per bucket |\n| Which build broke, and which fixed it? | run_history | yes | yes | 2 to 30 runs, runs_not_shown, 4 marks, ref 80, sha 64, job 80, url 500 |\n| What exactly changed in the code? | diff | yes | yes | path 200, ref 64, 1 to 6 hunks, 12 changed lines in all, line 160 |\n\n## How to plot data on each widget\n\n### compare: before and after\n\nUse it for a value measured before and after a deploy, rollback, fix or config change. One row per host, route, query or job, biggest movers first.\n\n1. Pick two windows of the same length, one before the change and one after. Run the same query on both.\n2. Take one number per row from each window, for example the p95 over the window.\n3. Set unit once. Set better to lower or higher. Add a threshold for the SLO or alert line.\n\n { \"type\": \"compare\", \"title\": \"p95 latency by route\", \"unit\": \"ms\", \"better\": \"lower\",\n \"threshold\": { \"value\": 500, \"label\": \"SLO 500 ms\" },\n \"rows\": [ { \"label\": \"POST /checkout\", \"before\": 180, \"after\": 640 },\n { \"label\": \"GET /cart\", \"before\": 95, \"after\": 110 } ] }\n\nA distribution is a compare of percentiles: use p50, p95 and p99 as rows, with the SLO as the threshold.\n\n### trend: a series over time\n\nUse it when the evidence is how a value moved. Send the raw samples as points and the times of the events that explain the shape as events.\n\n1. Run a range query. Keep the time and the value of every sample.\n2. Send them as points with t and v. t is an ISO time or Unix time in seconds or milliseconds. v may be a numeric string, as Prometheus returns it. A null or NaN is skipped.\n3. Tellagen puts the points on an even grid of at most max_points (default 240, most 500) and sets start and step_seconds. Samples that share a step combine with reduce. Use max for error rate and latency so a spike survives, mean for a smooth rate.\n4. Add up to three events: a deploy, an alert, a rollback. They become marks at the right index. An event outside the range is left out and reported.\n5. Fill source with kind, datasource, query and step.\n\n { \"type\": \"trend\", \"title\": \"5xx share of requests\", \"unit\": \"%\", \"reduce\": \"max\",\n \"points\": [ { \"t\": \"2026-11-02T14:00:00Z\", \"v\": \"0.24\" }, { \"t\": \"2026-11-02T14:01:00Z\", \"v\": \"0.27\" } ],\n \"events\": [ { \"at\": \"2026-11-02T14:42:00Z\", \"label\": \"Deploy\" }, { \"at\": \"2026-11-02T15:28:00Z\", \"label\": \"Rollback\" } ],\n \"threshold\": { \"value\": 1, \"label\": \"SLO 1%\" },\n \"source\": { \"kind\": \"promql\", \"datasource\": \"prometheus\", \"query\": \"sum(rate(...))\", \"step\": \"1m\" } }\n\nIf the values are already on an even grid, send series with start and step_seconds, and marks by index. Empty steps are filled with a straight line and reported, so say so in the step when it matters.\n\n### stats: the few numbers that matter\n\nAim for four or fewer. Each has a short label, a value, a caption that says what it is measured on, and a tone. The first four are tiles in one row, so put the total first and give a tone only to the exception. Items five to eight are drawn as plain rows under the tiles. When this Tellagen lists figure_extras_v1 in server_capabilities you may also send a title (up to 80 characters) to name the tiles, for example \"Tests of the run\", and up to eight items. Pass run_id to tellagen_build_figure for this check. Without figure_extras_v1 the builder drops the title and every item after the fourth, and says so in notes, because an older Tellagen rejects them and drops the whole figure.\n\n { \"type\": \"stats\", \"items\": [ { \"label\": \"Failed e2e tests\", \"value\": \"1 of 121\", \"caption\": \"master, Oct 30\", \"tone\": \"bad\" } ] }\n\nA tile caption says what the number is measured on. The name of the source, such as \"node --test summary\", belongs in a source chip (the step's evidence refs), not in a caption.\n\n### table: a ranked list\n\nTop queries, failing routes, slowest endpoints. Give columns, then one cell per column in every row. Numbers are written as text. Keep each cell under 64 characters.\n\n### checks: pass or fail per check\n\nA recovery checklist or a CI job list. Put failures first. The block holds 12 items, so for a larger list send every failure and the checks that matter, and give the counts of the rest in the step.\n\n { \"type\": \"checks\", \"title\": \"Jobs on run 41289327533\",\n \"items\": [ { \"label\": \"Frontend Tests\", \"state\": \"fail\", \"detail\": \"1 failed of 13516\" }, { \"label\": \"E2E Tests\", \"state\": \"pass\" } ] }\n\n### changes: a value that moved\n\nA setting, a version, a limit. Each row has a label and a from, a to, or both, with an optional note.\n\n### range_overlap: ranges that meet\n\nUse it when the cause is two ranges meeting: layout offsets, a maintenance window against an error spike, memory or port ranges. Two to four rows, each with a label, a from and a to (from not above to), all in one unit.\n\n1. Read each range from a tool result: the config, the layout, the window times as numbers.\n2. Send min and max for the whole range when you want an overview strip, and every row must fall inside them. Leave out window: Tellagen zooms to the overlap.\n3. Never send the overlap itself. Tellagen computes it, and the builder tells you what it is in summary.\n\n { \"type\": \"range_overlap\", \"title\": \"Header and sticky bar\", \"unit\": \"px\",\n \"rows\": [ { \"label\": \"Header\", \"from\": 0, \"to\": 153 }, { \"label\": \"Sticky bar\", \"from\": 149, \"to\": 197 } ] }\n\n### histogram: a distribution before and after\n\nUse it when an average hides a slow tail. Send bucket counts for two equal windows. Tellagen computes p50, p95, p99 and the share over the threshold from the buckets, so never send percentiles.\n\n1. Run the bucket query on a window before the change and on one of the same length after it, for example sum by (le) (increase(http_request_duration_seconds_bucket{service=\"checkout\"}[30m])) at the end of each window.\n2. Send the result as buckets: one entry per le with the cumulative before and after counts, as Prometheus returns them, numeric strings and \"+Inf\" included.\n3. The builder turns them into edges (lower_edge, default 0, then every finite le) and one count per bucket. Observations above the last finite le have no bucket: the builder rejects them unless you set overflow to drop, and then you say so in the step.\n4. Add the SLO as threshold, in the unit of the le values.\n\n { \"type\": \"histogram\", \"title\": \"Checkout latency\", \"unit\": \"s\",\n \"buckets\": [ { \"le\": \"0.1\", \"before\": \"820\", \"after\": \"610\" }, { \"le\": \"0.5\", \"before\": \"990\", \"after\": \"800\" },\n { \"le\": \"1\", \"before\": \"1000\", \"after\": \"940\" }, { \"le\": \"+Inf\", \"before\": \"1000\", \"after\": \"940\" } ],\n \"threshold\": { \"value\": 0.5, \"label\": \"SLO 500 ms\" } }\n\nIf you already have per-bucket counts, send edges, before and after instead: before and after hold exactly one count per bucket (one fewer than edges), none negative.\n\n### run_history: CI builds, jobs, canaries or deploys\n\nUse it for a regression in CI or a bad deploy. Runs go oldest first, each with a ref, a result (success, failure, cancelled, pending), and the failing job when one failed.\n\n1. List the workflow runs of the branch around the failure: the GitHub Actions REST list, the GitHub MCP list of workflow runs, or gh run list --json number,databaseId,headSha,conclusion,status,createdAt,startedAt,event,url.\n2. Send them as github_runs, as they came. The builder maps each run: ref #run_number, the head sha, the start time, the event as trigger, the run page as url, and the conclusion as result (timed_out and startup_failure count as failure). A run whose conclusion is skipped, neutral, stale or action_required has no result: leave it out or send runs yourself. Runs are put oldest first by time.\n3. Add job to the failing runs: the name of the job that failed, from the run's jobs list.\n4. Add marks for the change that broke it (change_ref regression) and the one that fixed it (fix). Give the sha of the change and the builder places the mark before the first run built from it, or give between with the refs of the two neighbouring runs. change_ref may be a change_refs role: regression_source and first_bad become regression, fix stays fix, others become change.\n5. Set repo to owner/name so each run links to its page, and an optional span such as { \"from\": \"#4151\", \"to\": \"#4163\", \"label\": \"E2E Tests failed\" }.\n6. A history holds at most 30 runs. If yours has more, send the 30 that matter (the runs around the break and the fix, oldest first) and set runs_not_shown to how many you left out; the strip then says \"N more runs not shown.\" Only when this Tellagen lists figure_extras_v1; without it the builder drops runs_not_shown and says so in notes.\n\n { \"type\": \"run_history\", \"title\": \"E2E on master\", \"repo\": \"acme/shop\", \"branch\": \"master\",\n \"github_runs\": [ { \"run_number\": 4150, \"head_sha\": \"9f2c1e0\", \"conclusion\": \"success\", \"created_at\": \"2026-10-30T08:00:00Z\", \"event\": \"push\" },\n { \"run_number\": 4151, \"head_sha\": \"4b7a2d1\", \"conclusion\": \"failure\", \"created_at\": \"2026-10-30T09:00:00Z\", \"event\": \"push\", \"job\": \"E2E Tests\" } ],\n \"marks\": [ { \"sha\": \"4b7a2d1\", \"change_ref\": \"regression\", \"title\": \"Move the header to a sticky layout\" } ] }\n\n### diff: the change that broke or fixed it\n\nUse it for the lines of the change that broke or fixed it. A short change is sent whole.\n\n1. Read the commit or pull request file from GitHub. additions and deletions are the size of the whole change, from the commit or the pull request, never counted by you from a part of it.\n2. If the change has 12 or fewer changed lines (in at most 6 hunks), send all of them. Send the file's patch as patch: the builder keeps every line, one hunk per @@ header.\n3. If it has more, send the whole hunks the claim cites, in file order, at most 3 hunks and at most 12 changed lines in all: give their numbers in select_hunks (1 is the first @@ header). If one hunk alone is longer than 12 changed lines, the builder cuts it after a complete pair of removed and added lines.\n4. Never send a changed line without its counterpart: each removed line comes with the line that replaced it, next to it, as a patch lists them. If you write hunks yourself, keep that order and keep the indentation.\n5. When the pickup lists diff_lines_v1 in server_capabilities, a hunk may also carry up to 2 unchanged lines (op context) before and after it, and old_no and new_no (1-based) on every line. The builder adds them from the patch headers when you pass run_id. Never invent a number: if you do not have the real numbers, leave all of them out. Without diff_lines_v1 the builder sends only changed lines and no numbers, and says so in notes.\n6. Set path, ref (the commit sha) and repo.\n\n { \"type\": \"diff\", \"path\": \"web/components/Header.tsx\", \"repo\": \"acme/shop\", \"ref\": \"4b7a2d1\", \"additions\": 1, \"deletions\": 1,\n \"hunks\": [ [ { \"op\": \"-\", \"text\": \" position: static;\" }, { \"op\": \"+\", \"text\": \" position: sticky;\" } ] ] }\n\nWith diff_lines_v1 the same change, with the unchanged lines around it and the numbers of the real file:\n\n { \"type\": \"diff\", \"path\": \"web/components/Header.tsx\", \"repo\": \"acme/shop\", \"ref\": \"4b7a2d1\", \"additions\": 1, \"deletions\": 1,\n \"hunks\": [ [ { \"op\": \"context\", \"text\": \".header {\", \"old_no\": 11, \"new_no\": 11 },\n { \"op\": \"-\", \"text\": \" position: static;\", \"old_no\": 12 }, { \"op\": \"+\", \"text\": \" position: sticky;\", \"new_no\": 12 },\n { \"op\": \"context\", \"text\": \"}\", \"old_no\": 13, \"new_no\": 13 } ] ] }\n\n## Where the figure goes\n\n- A causal step: set it as figure on the step in result_summary.causal_paths. Every type except table and changes is allowed there, at most 16 KB. This needs the diagnosis structure, which the pickup advertises as diagnosis_structure_v1. A Tellagen that does not know a figure type yet drops the figure and says so in the completion warnings (figure_invalid).\n- A timeline event: put it in blocks on tellagen_post_timeline_event or tellagen_update_timeline_event. Any type is allowed, up to 12 per event. An update replaces the whole array, so send every block you want to keep, and [] clears them. Set slot to summary to draw the block above the note, or anchor to the exact heading text it sits under. Not both. Set postmortem to false to keep a block out of the postmortem.\n\nCall tellagen_build_figure with placement step_figure or timeline_block, and use the block it returns as it is.\n\n## Getting the data from other servers\n\n- Grafana or Prometheus: a range query returns time and value pairs. Send them as points. Run the same query on two equal windows for a compare.\n- Loki: a count over time by step is a trend. A count by label over two windows is a compare.\n- Prometheus histograms: the _bucket series summed by le over two equal windows are a histogram. Send them as buckets.\n- GitHub Actions: failed jobs of one run go in checks, failures first. The runs of a branch are a run_history: send the run list as github_runs.\n- GitHub commits and pull requests: the lines that broke or fixed it are a diff. Send the file's patch, and the change's additions and deletions.\n- Kubernetes: restarts or ready counts before and after are a compare, a list of pods is a table.\n\n## If Tellagen rejects a figure\n\nThe builder names the field. For a timeline block the API answers 400 invalid_block with field and details.errors. Fix exactly those fields and send once more. Do not drop a figure to get past an error unless the data in it is not real.\n";
7
+ export declare function registerFigureTools(server: McpServer, client: TellagenClient): void;
7
8
  /** Registered from createServer, next to the other resources. */
8
9
  export declare function registerFigureResource(server: McpServer): void;
@@ -1,5 +1,7 @@
1
1
  import { z } from "zod";
2
- import { buildFigure, figureToolInputSchema } from "../figures.js";
2
+ import { activeRunId } from "../active-run.js";
3
+ import { supportsDiffLines, supportsFigureExtras } from "../diagnosis-structure.js";
4
+ import { buildFigure, figureToolInputSchema, withoutFigureExtrasInBlock } from "../figures.js";
3
5
  export const FIGURE_GUIDE_URI = "resource://tellagen/figure-guide";
4
6
  /** Added to the server instructions so every agent knows figures exist. */
5
7
  export const FIGURE_INSTRUCTIONS = `Figures: Tellagen draws typed widgets (stats, compare, trend, table, checks, changes, range_overlap, histogram, run_history, diff) from data you send, in the Diagnosis tab, on the timeline and in the postmortem. Use tellagen_build_figure to turn the numbers you read from a tool result into a figure Tellagen accepts: it puts a time series on an even grid of at most 500 points, turns deploy, alert and rollback times into marks, turns cumulative histogram buckets into bucket counts, maps a GitHub Actions run list to a run history, and enforces every limit. Attach the result as a causal step's figure or as a block on a timeline event. A figure owns its numbers: never repeat them in prose, never invent one, and keep units in the unit field. Read ${FIGURE_GUIDE_URI} to choose the widget that fits the question and to learn how to plot data on it.`;
@@ -23,7 +25,7 @@ Use tellagen_build_figure to make one. It reshapes the numbers you already read
23
25
 
24
26
  | The question | Widget | Step figure | Timeline block | Limits |
25
27
  | --- | --- | --- | --- | --- |
26
- | What are the few numbers that matter? | stats | yes | yes | 1 to 4 items, label 48, value 32, caption 64 |
28
+ | What are the few numbers that matter? | stats | yes | yes | 1 to 8 items (4 or fewer is best), title 80, label 48, value 32, caption 64 |
27
29
  | Did it get better, and is it inside the line? | compare | yes | yes | 1 to 8 rows, 3 details per row |
28
30
  | When did it start, and what happened around then? | trend | yes | yes | 2 to 500 points, 3 marks |
29
31
  | Which items rank highest? | table | no | yes | 1 to 6 columns, 1 to 12 rows, cell 64 |
@@ -31,8 +33,8 @@ Use tellagen_build_figure to make one. It reshapes the numbers you already read
31
33
  | What moved from one thing to another? | changes | no | yes | 1 to 8 rows, from and to 80, note 160 |
32
34
  | Where do two or more ranges meet? | range_overlap | yes | yes | 2 to 4 rows, label 80, unit 12 |
33
35
  | Did the slow tail move, when the average did not? | histogram | yes | yes | 3 to 61 edges (2 to 60 buckets), one count per bucket |
34
- | Which build broke, and which fixed it? | run_history | yes | yes | 2 to 30 runs, 4 marks, ref 80, sha 64, job 80, url 500 |
35
- | What exactly changed in the code? | diff | yes | yes | path 200, ref 64, 1 to 6 hunks, 12 lines in all, line 160 |
36
+ | Which build broke, and which fixed it? | run_history | yes | yes | 2 to 30 runs, runs_not_shown, 4 marks, ref 80, sha 64, job 80, url 500 |
37
+ | What exactly changed in the code? | diff | yes | yes | path 200, ref 64, 1 to 6 hunks, 12 changed lines in all, line 160 |
36
38
 
37
39
  ## How to plot data on each widget
38
40
 
@@ -71,10 +73,12 @@ If the values are already on an even grid, send series with start and step_secon
71
73
 
72
74
  ### stats: the few numbers that matter
73
75
 
74
- Up to four. Each has a short label, a value, a caption that says what it is measured on, and a tone.
76
+ Aim for four or fewer. Each has a short label, a value, a caption that says what it is measured on, and a tone. The first four are tiles in one row, so put the total first and give a tone only to the exception. Items five to eight are drawn as plain rows under the tiles. When this Tellagen lists figure_extras_v1 in server_capabilities you may also send a title (up to 80 characters) to name the tiles, for example "Tests of the run", and up to eight items. Pass run_id to tellagen_build_figure for this check. Without figure_extras_v1 the builder drops the title and every item after the fourth, and says so in notes, because an older Tellagen rejects them and drops the whole figure.
75
77
 
76
78
  { "type": "stats", "items": [ { "label": "Failed e2e tests", "value": "1 of 121", "caption": "master, Oct 30", "tone": "bad" } ] }
77
79
 
80
+ A tile caption says what the number is measured on. The name of the source, such as "node --test summary", belongs in a source chip (the step's evidence refs), not in a caption.
81
+
78
82
  ### table: a ranked list
79
83
 
80
84
  Top queries, failing routes, slowest endpoints. Give columns, then one cell per column in every row. Numbers are written as text. Keep each cell under 64 characters.
@@ -126,6 +130,7 @@ Use it for a regression in CI or a bad deploy. Runs go oldest first, each with a
126
130
  3. Add job to the failing runs: the name of the job that failed, from the run's jobs list.
127
131
  4. Add marks for the change that broke it (change_ref regression) and the one that fixed it (fix). Give the sha of the change and the builder places the mark before the first run built from it, or give between with the refs of the two neighbouring runs. change_ref may be a change_refs role: regression_source and first_bad become regression, fix stays fix, others become change.
128
132
  5. Set repo to owner/name so each run links to its page, and an optional span such as { "from": "#4151", "to": "#4163", "label": "E2E Tests failed" }.
133
+ 6. A history holds at most 30 runs. If yours has more, send the 30 that matter (the runs around the break and the fix, oldest first) and set runs_not_shown to how many you left out; the strip then says "N more runs not shown." Only when this Tellagen lists figure_extras_v1; without it the builder drops runs_not_shown and says so in notes.
129
134
 
130
135
  { "type": "run_history", "title": "E2E on master", "repo": "acme/shop", "branch": "master",
131
136
  "github_runs": [ { "run_number": 4150, "head_sha": "9f2c1e0", "conclusion": "success", "created_at": "2026-10-30T08:00:00Z", "event": "push" },
@@ -134,15 +139,25 @@ Use it for a regression in CI or a bad deploy. Runs go oldest first, each with a
134
139
 
135
140
  ### diff: the change that broke or fixed it
136
141
 
137
- Use it for the lines that matter in the change, not the whole diff.
142
+ Use it for the lines of the change that broke or fixed it. A short change is sent whole.
138
143
 
139
144
  1. Read the commit or pull request file from GitHub. additions and deletions are the size of the whole change, from the commit or the pull request, never counted by you from a part of it.
140
- 2. Send the file's patch as patch: the builder keeps its + and - lines, one hunk per @@ header. It must have at most 12 such lines in at most 6 hunks; otherwise copy the lines that show the change into hunks yourself, as they are, indentation kept.
141
- 3. Set path, ref (the commit sha) and repo.
145
+ 2. If the change has 12 or fewer changed lines (in at most 6 hunks), send all of them. Send the file's patch as patch: the builder keeps every line, one hunk per @@ header.
146
+ 3. If it has more, send the whole hunks the claim cites, in file order, at most 3 hunks and at most 12 changed lines in all: give their numbers in select_hunks (1 is the first @@ header). If one hunk alone is longer than 12 changed lines, the builder cuts it after a complete pair of removed and added lines.
147
+ 4. Never send a changed line without its counterpart: each removed line comes with the line that replaced it, next to it, as a patch lists them. If you write hunks yourself, keep that order and keep the indentation.
148
+ 5. When the pickup lists diff_lines_v1 in server_capabilities, a hunk may also carry up to 2 unchanged lines (op context) before and after it, and old_no and new_no (1-based) on every line. The builder adds them from the patch headers when you pass run_id. Never invent a number: if you do not have the real numbers, leave all of them out. Without diff_lines_v1 the builder sends only changed lines and no numbers, and says so in notes.
149
+ 6. Set path, ref (the commit sha) and repo.
142
150
 
143
- { "type": "diff", "path": "web/components/Header.tsx", "repo": "acme/shop", "ref": "4b7a2d1", "additions": 14, "deletions": 3,
151
+ { "type": "diff", "path": "web/components/Header.tsx", "repo": "acme/shop", "ref": "4b7a2d1", "additions": 1, "deletions": 1,
144
152
  "hunks": [ [ { "op": "-", "text": " position: static;" }, { "op": "+", "text": " position: sticky;" } ] ] }
145
153
 
154
+ With diff_lines_v1 the same change, with the unchanged lines around it and the numbers of the real file:
155
+
156
+ { "type": "diff", "path": "web/components/Header.tsx", "repo": "acme/shop", "ref": "4b7a2d1", "additions": 1, "deletions": 1,
157
+ "hunks": [ [ { "op": "context", "text": ".header {", "old_no": 11, "new_no": 11 },
158
+ { "op": "-", "text": " position: static;", "old_no": 12 }, { "op": "+", "text": " position: sticky;", "new_no": 12 },
159
+ { "op": "context", "text": "}", "old_no": 13, "new_no": 13 } ] ] }
160
+
146
161
  ## Where the figure goes
147
162
 
148
163
  - A causal step: set it as figure on the step in result_summary.causal_paths. Every type except table and changes is allowed there, at most 16 KB. This needs the diagnosis structure, which the pickup advertises as diagnosis_structure_v1. A Tellagen that does not know a figure type yet drops the figure and says so in the completion warnings (figure_invalid).
@@ -163,10 +178,12 @@ Call tellagen_build_figure with placement step_figure or timeline_block, and use
163
178
 
164
179
  The builder names the field. For a timeline block the API answers 400 invalid_block with field and details.errors. Fix exactly those fields and send once more. Do not drop a figure to get past an error unless the data in it is not real.
165
180
  `;
166
- export function registerFigureTools(server) {
181
+ const isDiff = (figure) => typeof figure === "object" && figure !== null && figure.type === "diff";
182
+ const usesFigureExtras = (figure) => withoutFigureExtrasInBlock(figure).what.length > 0;
183
+ export function registerFigureTools(server, client) {
167
184
  server.registerTool("tellagen_build_figure", {
168
185
  title: "Build a figure",
169
- description: "Turn numbers you already read from a tool result into a figure (a typed widget) that Tellagen draws, and check it against Tellagen's limits before you send it. Widgets: stats (up to 4 headline numbers), compare (before and after per host, route or job, with an SLO line), trend (a series over time with up to 3 marks), table (a ranked list, up to 12 rows), checks (pass or fail per check, up to 12), changes (a value that moved from one thing to another), range_overlap (2 to 4 ranges that meet), histogram (bucket counts before and after), run_history (CI or deploy runs with the regression and fix marks), diff (up to 12 changed lines). For a time series send raw samples as points and the deploy, alert or rollback times as events: the tool puts them on an even grid of at most 500 points and works out the mark positions. For a histogram send Prometheus cumulative le buckets as buckets; for a run history send the GitHub Actions run list as github_runs; for a diff send the patch. It has no data of its own and never invents a value, so send only numbers from a tool result you can cite. placement step_figure is for a causal step (any type except table and changes, one per step). placement timeline_block is for a timeline event (any type). Read resource://tellagen/figure-guide to choose the widget and to see how to plot data on it.",
186
+ description: "Turn numbers you already read from a tool result into a figure (a typed widget) that Tellagen draws, and check it against Tellagen's limits before you send it. Widgets: stats (headline numbers: aim for 4, up to 8 with figure_extras_v1, and an optional title), compare (before and after per host, route or job, with an SLO line), trend (a series over time with up to 3 marks), table (a ranked list, up to 12 rows), checks (pass or fail per check, up to 12), changes (a value that moved from one thing to another), range_overlap (2 to 4 ranges that meet), histogram (bucket counts before and after), run_history (CI or deploy runs with the regression and fix marks), diff (the changed lines of a code change). For a time series send raw samples as points and the deploy, alert or rollback times as events: the tool puts them on an even grid of at most 500 points and works out the mark positions. For a histogram send Prometheus cumulative le buckets as buckets; for a run history send the GitHub Actions run list as github_runs; for a diff send the patch of one file: a change of 12 or fewer changed lines is sent whole with each removed line next to the line that replaced it, a longer one needs select_hunks (at most 3 hunks). Pass run_id so unchanged lines and line numbers are added only when this Tellagen lists diff_lines_v1, and a stats title, more than 4 stats and runs_not_shown only when it lists figure_extras_v1. It has no data of its own and never invents a value, so send only numbers from a tool result you can cite. placement step_figure is for a causal step (any type except table and changes, one per step). placement timeline_block is for a timeline event (any type). Read resource://tellagen/figure-guide to choose the widget and to see how to plot data on it.",
170
187
  inputSchema: {
171
188
  placement: z
172
189
  .enum(["step_figure", "timeline_block"])
@@ -175,9 +192,17 @@ export function registerFigureTools(server) {
175
192
  slot: z.literal("summary").optional().describe("timeline_block only: draw the block above the note. Not together with anchor."),
176
193
  anchor: z.string().max(80).optional().describe("timeline_block only: the exact heading text in the note that the block sits under. Not together with slot."),
177
194
  postmortem: z.boolean().optional().describe("timeline_block only: false keeps the block out of the postmortem."),
195
+ run_id: z
196
+ .string()
197
+ .min(1)
198
+ .optional()
199
+ .describe("The investigation run you are working on. For a diff, a stats or a run_history figure, Tellagen is asked which features it lists in server_capabilities (diff_lines_v1: unchanged lines and line numbers; figure_extras_v1: a stats title, more than 4 stats, runs_not_shown). Without it the latest pickup of this process decides."),
178
200
  },
179
- }, async (input) => {
180
- const result = buildFigure(input);
201
+ }, async ({ run_id: givenRunId, ...input }) => {
202
+ const run_id = activeRunId(client, givenRunId);
203
+ const diffLines = isDiff(input.figure) ? await supportsDiffLines(client, run_id) : false;
204
+ const figureExtras = usesFigureExtras(input.figure) ? await supportsFigureExtras(client, run_id) : false;
205
+ const result = buildFigure(input, { diffLines, figureExtras });
181
206
  if (!result.ok) {
182
207
  return {
183
208
  content: [
@@ -1 +1 @@
1
- {"version":3,"file":"figures.js","sourceRoot":"","sources":["../../src/tools/figures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,kCAAkC,CAAC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AAe;KAC1B,EACD,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QACd,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;KAC7E,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -1,3 +1,31 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { TellagenClient } from "../client.js";
3
+ /** The screenshot limits of a finding, as Tellagen enforces them. */
4
+ export declare const SCREENSHOT_LIMITS: {
5
+ readonly count: 20;
6
+ readonly bytesEach: number;
7
+ readonly bytesTogether: number;
8
+ };
9
+ type ScreenshotInput = {
10
+ base64?: string;
11
+ url?: string;
12
+ };
13
+ type RefWithScreenshots = {
14
+ screenshots?: ScreenshotInput[];
15
+ };
16
+ /** The size in bytes of the data a base64 text holds. */
17
+ export declare function base64Bytes(value: string): number;
18
+ /**
19
+ * Refuses screenshots Tellagen would refuse, before anything is sent, and
20
+ * names the limit. A screenshot given as a URL is fetched by Tellagen and is
21
+ * only counted here.
22
+ */
23
+ export declare function checkScreenshotSizes(screenshots: ScreenshotInput[] | undefined, refs: RefWithScreenshots[] | undefined): void;
24
+ /**
25
+ * The idempotency key of a finding: a hash of what is sent. The same finding
26
+ * sent twice (a repeat after a timeout, by this server or by the model)
27
+ * carries the same key, and Tellagen returns the first finding.
28
+ */
29
+ export declare function findingIdempotencyKey(incidentId: number, body: Record<string, unknown>): string;
3
30
  export declare function registerFindingTools(server: McpServer, client: TellagenClient): void;
31
+ export {};