qyl-mcp-server 7.6.0 → 7.7.0

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 (44) hide show
  1. package/README.md +89 -81
  2. package/dist/analysis-client.d.ts +5 -0
  3. package/dist/analysis-client.js +40 -0
  4. package/dist/analysis-client.js.map +1 -0
  5. package/dist/analysis-tools.d.ts +3 -0
  6. package/dist/analysis-tools.js +165 -0
  7. package/dist/analysis-tools.js.map +1 -0
  8. package/dist/ci.d.ts +1 -1
  9. package/dist/ci.js +7 -44
  10. package/dist/ci.js.map +1 -1
  11. package/dist/collector-resources.d.ts +6 -0
  12. package/dist/collector-resources.js +26 -22
  13. package/dist/collector-resources.js.map +1 -1
  14. package/dist/collector.d.ts +4 -2
  15. package/dist/collector.js +13 -3
  16. package/dist/collector.js.map +1 -1
  17. package/dist/config.d.ts +2 -2
  18. package/dist/config.js +2 -2
  19. package/dist/mcp-app.html +2 -2
  20. package/dist/mcp-dashboard.html +3 -3
  21. package/dist/mcp-home.html +1 -1
  22. package/dist/mcp-semconv.d.ts +3 -4
  23. package/dist/mcp-semconv.js +10 -8
  24. package/dist/mcp-semconv.js.map +1 -1
  25. package/dist/metrics-tools.d.ts +0 -14
  26. package/dist/metrics-tools.js +14 -71
  27. package/dist/metrics-tools.js.map +1 -1
  28. package/dist/metrics.js +16 -3
  29. package/dist/metrics.js.map +1 -1
  30. package/dist/request-scope.d.ts +3 -0
  31. package/dist/request-scope.js +7 -3
  32. package/dist/request-scope.js.map +1 -1
  33. package/dist/secret-redactor.js +13 -0
  34. package/dist/secret-redactor.js.map +1 -1
  35. package/dist/server.js +17 -101
  36. package/dist/server.js.map +1 -1
  37. package/dist/telemetry.js +6 -6
  38. package/dist/telemetry.js.map +1 -1
  39. package/dist/tools.d.ts +0 -2
  40. package/dist/tools.js +18 -168
  41. package/dist/tools.js.map +1 -1
  42. package/dist/write-tools.js +15 -69
  43. package/dist/write-tools.js.map +1 -1
  44. package/package.json +4 -4
package/README.md CHANGED
@@ -27,7 +27,6 @@ its own.
27
27
  Both use MCP TypeScript SDK v2: Streamable HTTP through `createMcpHandler`
28
28
  and stdio through `serveStdio`, with their documented compatibility defaults.
29
29
  One factory serves revision `2026-07-28` and supported 2025-era requests.
30
- Events require `2026-07-28`.
31
30
  The HTTP server serves a product page at `/`; `/mcp` is the only protocol
32
31
  endpoint.
33
32
 
@@ -63,81 +62,54 @@ an enabled module proves a client has been provisioned.
63
62
 
64
63
  ## Tools
65
64
 
66
- **Telemetry** — `list_traces`, `get_trace`, `list_sessions`, `search_logs`,
67
- `ci_log`, `display_traces`, `display_mcp_dashboard`.
68
-
69
- `list_traces` filters by a `start_time`/`end_time` window (RFC 3339, start
70
- inclusive, end exclusive), `service_name` (traces with a span from that
71
- service) and `errors_only`. `list_sessions` filters by `active_only` and the
72
- same window on the session start. `search_logs` filters by `trace_id`,
73
- `session_id`, `service_name`, `severity_min`, a body substring `query` and the
74
- window. Every list tool pages the same way: the output carries `has_more` and,
75
- when more exist, `next_cursor`; pass it back as `cursor` with the same filters
76
- for the next page. A cursor is opaque; one that is not ours is refused with
77
- `invalid_argument` rather than answered with the first page again.
78
-
79
- `get_trace` returns every span by default. `errors_only` selects error spans;
80
- `max_spans` (1–1000) caps the result after filtering in Collector order.
81
- `include_attributes=false` omits span, resource, event, link and instrumentation
82
- scope attribute collections, including any returned root-span copy. Trace
83
- totals remain the Collector's totals; the text reports matching and returned
84
- counts. `ci_log.service_prefix` is case-sensitive, defaults to `qyl-ci`, and
85
- filters both recent runs and individual phase spans.
86
-
87
- **Metrics** — `list_metrics`, `get_metric_series`, `query_metric`. Read in that
88
- order: the catalog gives you an exact instrument name and how many attribute
89
- streams it has, series discovery tells you which attribute keys are worth
90
- grouping or filtering on, and the range query answers the actual question —
91
- a window, a bucket width in whole milliseconds (`step_ms`), a reducer (`avg`,
92
- `min`, `max`, `sum`, `count`, `last`, `p50`, `p90`, `p95`, `p99`), optional
93
- `group_by` keys, and optional `matchers`, each `{ key, op, value }` with `op`
94
- `eq` (exact) or `prefix`; the server serializes them to the Collector's
95
- `attr` / `attr_prefix` parameters. One bucket spanning the whole window
96
- collapses the answer to a single number. The catalog and the series list page
97
- with `cursor` like the telemetry lists.
98
-
99
- **App-only** — `fetch_telemetry` is called by the bundled MCP Apps, not by a
100
- model. Its input is one of four shapes selected by `view` (`traces`, `trace`,
101
- `logs`, `mcp_stats`); the `trace` view requires `trace_id` at the schema layer.
102
-
103
- **Writes** — `create_annotation`, `update_annotation`, `create_saved_query`,
104
- `update_saved_query` and `delete` change only objects users create in qyl, in
105
- the caller's Collector project: annotations (plain-text notes of at most 2000
106
- characters on a trace, span or session) and saved queries (named filters for
107
- traces, logs or metrics). `delete` takes `kind` (`annotation` or
108
- `saved_query`; alert rules follow with Contract 11.7.0), `id` and `etag`. No
109
- tool deletes or edits traces, logs or metrics; retention removes telemetry.
110
- Updates and deletes send the `etag` as `If-Match`: a stale one fails with
111
- `precondition_failed`, a duplicate saved-query name with `conflict`.
112
- `list_saved_queries` and `run_saved_query` read saved queries; `get_trace` and
113
- `list_sessions` return the annotations on what they read. Demo mode keeps none
114
- of these objects and refuses these tools.
115
-
116
- **Failures** — every failed call returns `isError: true`, the message as text,
117
- and `structuredContent.error = { code, message, retryable }` with the
118
- contract's `ToolErrorCode`.
119
-
120
- The thirteen read tools carry `readOnlyHint: true` and only query the
121
- configured collector. The create tools carry `destructiveHint: false` and
122
- `idempotentHint: false`; the update tools and `delete` carry
123
- `destructiveHint: true` and `idempotentHint: true`. On the hosted server
124
- `qyl:read` covers the read tools, `qyl:write` adds the create and update tools,
125
- and `qyl:delete` adds `delete`.
126
-
127
- The `display_*` tools return MCP Apps UI resources as single-file viewers.
128
-
129
- Every tool runs inside its request scope. Cancellation: a
130
- `notifications/cancelled` for the request, or a closed connection, aborts the
131
- in-flight collector fetch instead of waiting out its timeout. Progress: a
132
- request that carries a `progressToken` gets `notifications/progress` per
133
- completed step, one per collector round trip plus a final "Result ready"
134
- (`ci_log` with a `run_id` reports the flatten into legs as a step of its own).
135
- Logging: the server declares no `logging` capability and sends no
136
- `notifications/message`, including when a client supplies a log level.
137
- Operational error diagnostics go to stderr; native tool timing/status telemetry
138
- uses OpenTelemetry. Requested progress and cancellation remain available.
139
- [Source and test commands/output, 2026-10-08](https://github.com/ANcpLua/qyl.mcp/blob/main/docs/evidence/2026-10-08-followup-01.md).
65
+ The server publishes 32 tools, including one app-only read tool. Reads use the collector's
66
+ analysis queries and the generated qyl API contracts.
140
67
 
68
+ | Purpose | Tools |
69
+ | --- | --- |
70
+ | Investigate failures | `triage`, `list_failures`, `get_failure_context`, `compare_groups`, `compare_traces`, `verify_fix` |
71
+ | Explore telemetry | `aggregate_telemetry`, `discover_attributes`, `get_agent_run`, `list_releases`, `get_service_map`, `check_telemetry_health`, `get_mcp_stats` |
72
+ | Read executions | `list_sessions`, `list_traces`, `get_trace`, `search_logs`, `ci_log` |
73
+ | Read metrics | `list_metrics`, `get_metric_series`, `query_metric` |
74
+ | Saved questions | `list_saved_queries`, `run_saved_query` |
75
+ | Interactive views | `display_traces`, `display_mcp_dashboard`, `fetch_telemetry` (app-only) |
76
+ | Write project records | `create_annotation`, `update_annotation`, `create_saved_query`, `update_saved_query`, `delete`, `update_failure_status` |
77
+
78
+ Read tools accept an absolute RFC 3339 time window or `lookback_minutes` and report the
79
+ resolved `window` and `coverage`: examined, matched and returned counts, truncation,
80
+ scan completeness and observation time. Unknown counts are null. Filtering happens before
81
+ pagination; reuse an opaque `next_cursor` with the same filters to continue a page.
82
+
83
+ Shared matchers support `eq`, `neq`, `in`, `prefix`, `contains`, `exists`, `gt`, `gte`,
84
+ `lt` and `lte`, with span, resource or log scope. Span durations are milliseconds;
85
+ metrics retain their recorded units. Histogram percentiles identify their approximation,
86
+ and cumulative counter changes account for resets. Verification reports insufficient
87
+ traffic as pending rather than calling an unobserved failure fixed.
88
+
89
+ `get_trace` supports all spans, errors, errors with ancestors, or the critical path,
90
+ selected attributes and correlated logs. `display_traces` preserves the selected span
91
+ and can compare two executions. Notes and bookmarks are created only through explicit
92
+ viewer actions. `display_mcp_dashboard` uses the same MCP aggregates as `get_mcp_stats`,
93
+ shows the numerator and denominator behind rates, classifies failures, and opens matching
94
+ calls from aggregate selections. `fetch_telemetry` serves five app-only views: traces,
95
+ trace, logs, MCP statistics and comparison, with incremental refresh and field selection.
96
+
97
+ The 26 read tools carry `readOnlyHint: true`. Six write tools change annotations, saved
98
+ queries or failure status in the caller's project. An annotation can target a trace, span,
99
+ session or failure and has optional labels and a classification. A bookmark is a note
100
+ labelled `bookmark`. Updates and deletes require the current `etag`; stale writes are
101
+ rejected. Optional `idempotency_key` on create calls reuses the stored result for 24 hours.
102
+ Omitting it creates a new record. No tool edits or deletes recorded telemetry.
103
+
104
+ `qyl:read` covers reads, `qyl:write` adds creation and updates, and `qyl:delete` permits
105
+ `delete`. A missing scope returns the supported OAuth step-up challenge. Failed calls
106
+ carry a stable code, retryability, the problem type and field-level validation details
107
+ when available. Secrets are redacted before model text or structured content is returned.
108
+
109
+ Every tool runs inside its request scope, forwarding cancellation to the collector.
110
+ Requested progress reports completion; no logging notifications are sent to clients.
111
+ Analysis reads require a live collector. Synthetic demo data remains available for local
112
+ UI fixtures, and is never substituted when a collector fails.
141
113
 
142
114
  Every inbound `tools/call` on a local server — `--stdio`, or HTTP without
143
115
  `MCP_PUBLIC_URL` — records only its tool name, timing, status and error type,
@@ -155,14 +127,14 @@ multi-tenant audit log.
155
127
  | --- | --- |
156
128
  | `QYL_COLLECTOR_URL` | Collector read API base; default `http://127.0.0.1:5100`. Also the OTLP base when set. |
157
129
  | `QYL_API_KEY` | Collector credential for reads and OTLP; the write tools need the Collector's `write` and `delete` roles on it. Outgoing only. |
158
- | `QYL_PROJECT` | Server-owned collector project scope. Unset, the server sends no project-scope header, so the Collector's default project applies; the Events subscription source key records that as `default`. Never accepted as tool input. This is the only place that states the default; other documents link here. |
130
+ | `QYL_PROJECT` | Server-owned collector project scope. Unset, the server sends no project-scope header, so the Collector's default project applies. Never accepted as tool input. This is the only place that states the default; other documents link here. |
159
131
  | `MCP_COLLECTOR_PROJECTS` | Optional secret JSON mapping validated Auth0 subjects to project-bound Collector keys; see account isolation below. |
160
132
  | `QYL_OTLP_ENDPOINT` | Optional OTLP base for self-telemetry. |
161
- | `QYL_DEMO=1` | Explicit, visibly labelled demo telemetry. A collector failure never silently substitutes demo data. |
133
+ | `QYL_DEMO=1` | Local synthetic UI fixtures; analysis tools require a live collector. |
162
134
  | `QYL_MCP_TELEMETRY=0` | Disable MCP spans, metrics, and operation logs. |
163
135
  | `QYL_MCP_CAPTURE_CONTENT=1` | Workbench content capture; native incoming tool-call telemetry never supplies request or response bodies. |
164
136
  | `QYL_MCP_NATIVE_STATE_PATH` | Override the native execution-evidence path. |
165
- | `MCP_EVENTS_STORE` | Persistent Events subscription file; requires Auth0 and the access-check credentials below. |
137
+ | `MCP_EVENTS_STORE` | Optional internal Events subscription file; leave unset for the shared ChatGPT/Claude deployment. |
166
138
  | `MCP_EVENTS_AUTH0_CLIENT_ID` / `MCP_EVENTS_AUTH0_CLIENT_SECRET` | Dedicated Management API application with `read:users`, `read:clients`, `read:client_grants`, `read:grants`; resolves CIMD identities and keeps access checks current without storing subscriber tokens. |
167
139
  | `MCP_EVENTS_POLL_MS` | Collector polling interval, at least 5000 ms; default 30000 ms. |
168
140
  | `PORT` | HTTP listener port; default `3001`. |
@@ -176,6 +148,11 @@ so serving it requires Bun.
176
148
 
177
149
  ### Account isolation for hosted Auth0
178
150
 
151
+ The existing tenant's API scopes, named client grants and mapped-user permissions
152
+ are managed by [the Auth0 configuration and drift checker](https://github.com/ANcpLua/qyl.mcp/tree/main/tools/auth0).
153
+ Run its check before applying changes; it preserves unrelated tenant configuration
154
+ and never creates identities or rotates credentials.
155
+
179
156
  To give a reviewer access to sample data, provision a separate Collector
180
157
  project/key through the Collector's `QYL_OTLP_PROJECT_KEYS` configuration and
181
158
  assign that key to the reviewer's validated Auth0 subject. Configure the MCP
@@ -197,20 +174,51 @@ existing deployment-wide credential behavior is retained.
197
174
 
198
175
  Only the verified SDK `AuthInfo.extra.subject` selects the project. Tool inputs
199
176
  and request metadata cannot override it. All telemetry tools, viewer refreshes
200
- and Events queries use that account's project credential. Removing the account
201
- assignment revokes its Events subscription on the next access check. Project
177
+ use that account's project credential. Project
202
178
  keys are redacted from text and structured results, including keys nested in
203
179
  this JSON configuration. Keep the map in host secrets and out of the plugin ZIP.
204
180
 
205
181
  `bun run smoke:projects` from the repository root checks every tool, the
206
- writes included, viewer query paths, both protocol eras and Events against a
182
+ writes included, viewer query paths and both protocol eras against a
207
183
  real local Collector with two temporary projects. Set `QYL_COLLECTOR_PROJECT` to its
208
184
  `.csproj` when using a different checkout. The script uses local test identities
209
185
  and an in-process signed webhook receiver; the hosted reviewer OAuth login and
210
186
  real ChatGPT demonstration are separate checks before upload.
211
187
 
188
+ ### Seeded analysis verification
189
+
190
+ The collector fixture `tests/Qyl.Collector.Tests/Fixtures/seed-answer-key.py`
191
+ emits real OTLP data and writes the trace IDs and absolute windows used by
192
+ `server/verify-answer-key.mjs`. Seed a fresh temporary collector database before
193
+ each run because the checks exercise annotations and failure status changes.
194
+ After building this workspace, run the verifier from `server/`:
195
+
196
+ ```sh
197
+ QYL_ANSWER_KEY_FILE=/tmp/qyl-answer-key.json \
198
+ QYL_ANSWER_KEY_COLLECTOR=http://127.0.0.1:5510 \
199
+ QYL_ANSWER_KEY_OTLP=http://127.0.0.1:5518 \
200
+ node --test verify-answer-key.mjs
201
+ ```
202
+
203
+ `QYL_BIN=/path/to/installed/qyl node live-tools-smoke.mjs` additionally checks
204
+ all 32 tools against an isolated collector started by the published CLI.
205
+
212
206
  ## Release notes
213
207
 
208
+ ### 7.7.0
209
+
210
+ - Expand to 32 tools: failure triage and lifecycle, trace/group comparisons, fix verification, telemetry aggregation and discovery, agent runs, releases, service maps, telemetry health and MCP statistics.
211
+ - Use the collector's shared typed analysis contracts for filtering, pagination, coverage and saved-query execution; retain official SDKs/exporters and project-scoped authorization.
212
+ - Add responsive trace comparison, explicit note/bookmark controls, dashboard filters and drill-downs, with denominator counts behind rates.
213
+ - Preserve numeric agent token usage during secret redaction, and verify the new surface against real OTLP fixtures plus both protocol eras.
214
+
215
+
216
+ ### 7.6.1
217
+
218
+ - Manage existing Auth0 API permissions, client grants and mapped-user permissions with scoped tenant configuration and a drift check.
219
+
220
+ - Use the qyl-owned semantic conventions package generated from the same registry as C#. MCP attribute names, values, operation events, duration metrics and seconds remain consistent across both languages. The official OpenTelemetry SDKs and exporters and the shared API contracts remain in use.
221
+
214
222
  ### 7.6.0
215
223
 
216
224
  - Contract 12.0.0 (`@ancplua/qyl-api-schema` 12.0.0, revision
@@ -0,0 +1,5 @@
1
+ /** Shared HTTP transport; every callable analysis operation is registered by name. */
2
+ import type { CallToolResult } from "@modelcontextprotocol/server";
3
+ import type * as z from "zod/v4";
4
+ import type { ToolScope } from "./request-scope.js";
5
+ export declare function queryAnalysis<Input extends object, Output extends object>(operation: string, input: Input, schema: z.ZodType<Output>, scope: ToolScope): Promise<CallToolResult>;
@@ -0,0 +1,40 @@
1
+ import { CollectorError, collectorPost, parseCollectorBody } from "./collector.js";
2
+ import { telemetryToolResult } from "./telemetry-redaction.js";
3
+ export async function queryAnalysis(operation, input, schema, scope) {
4
+ if (process.env.QYL_DEMO === "1") {
5
+ throw new CollectorError("Analysis needs a live qyl Collector; unset QYL_DEMO to query recorded telemetry.");
6
+ }
7
+ const path = `/api/v1/analysis/${operation}`;
8
+ const deadline = Date.now() + 55_000;
9
+ let query = input;
10
+ let previousPageSize = Infinity;
11
+ for (;;) {
12
+ const remaining = deadline - Date.now();
13
+ if (remaining <= 0)
14
+ throw new CollectorError("The query exceeded its time budget; narrow the time window and matchers.");
15
+ const response = await collectorPost(path, query, { ...scope.collector, timeoutMs: remaining });
16
+ const output = parseCollectorBody(response, path, schema);
17
+ const result = telemetryToolResult(`${operation}: results are in the structured data.`, output);
18
+ // Bytes give a conservative upper bound even for token-dense identifiers.
19
+ const bytes = Buffer.byteLength(JSON.stringify(result), "utf8");
20
+ if (bytes <= 24_000) {
21
+ await scope.step(`Queried ${operation}`);
22
+ return result;
23
+ }
24
+ // Re-query the collector so its cursor, coverage and totals describe the
25
+ // smaller page. Never slice a response and leave its paging metadata stale.
26
+ const args = query;
27
+ const page = output;
28
+ const canPage = (operation === "display_traces" && !args.trace_id)
29
+ || (operation === "fetch_telemetry" && args.view === "traces");
30
+ if (canPage && Array.isArray(page.traces) && page.traces.length > 1 && page.traces.length < previousPageSize) {
31
+ previousPageSize = page.traces.length;
32
+ const limit = Math.max(1, Math.floor(page.traces.length * 24_000 / bytes * 0.8));
33
+ const window = page.window;
34
+ query = { ...args, ...window, limit };
35
+ continue;
36
+ }
37
+ throw new CollectorError("The result exceeds the response budget; reduce limit or narrow the time window and matchers.", false, 413, "collector_rejected");
38
+ }
39
+ }
40
+ //# sourceMappingURL=analysis-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-client.js","sourceRoot":"","sources":["../src/analysis-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,SAAiB,EACjB,KAAY,EACZ,MAAyB,EACzB,KAAgB;IAEhB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;QACjC,MAAM,IAAI,cAAc,CAAC,kFAAkF,CAAC,CAAC;IAC/G,CAAC;IACD,MAAM,IAAI,GAAG,oBAAoB,SAAS,EAAE,CAAC;IAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;IACrC,IAAI,KAAK,GAAW,KAAK,CAAC;IAC1B,IAAI,gBAAgB,GAAG,QAAQ,CAAC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,MAAM,CAAC,MAAM,CAAC;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;YACjF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgE,CAAC;YACrF,KAAK,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC;YACtC,SAAS;QACX,CAAC;QACD,MAAM,IAAI,cAAc,CACtB,8FAA8F,EAC9F,KAAK,EAAE,GAAG,EAAE,oBAAoB,CACjC,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Named analysis tools backed by the collector's generated query contracts. */
2
+ import type { McpServer } from "@modelcontextprotocol/server";
3
+ export declare function registerAnalysisTools(server: McpServer): void;
@@ -0,0 +1,165 @@
1
+ import { compactOutputSchema, contractSchema } from "./contract-validation.js";
2
+ import { runTool } from "./request-scope.js";
3
+ import { READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS, TELEMETRY_TOOL_AUTH_META } from "./tools.js";
4
+ import { queryAnalysis } from "./analysis-client.js";
5
+ import { collectorPatch, parseCollectorBody } from "./collector.js";
6
+ import { ifMatch } from "./collector-resources.js";
7
+ import { assertToolScopes, toolScopeChallenge } from "./tool-scopes.js";
8
+ import { QYL_MCP_SCOPE, QYL_MCP_WRITE_SCOPE } from "./oauth.js";
9
+ import { telemetryToolResult } from "./telemetry-redaction.js";
10
+ const TriageInputSchema = contractSchema("Mcp.Tools.TriageInput");
11
+ const TriageOutputSchema = contractSchema("Mcp.Tools.TriageOutput");
12
+ const ListFailuresInputSchema = contractSchema("Mcp.Tools.ListFailuresInput");
13
+ const ListFailuresOutputSchema = contractSchema("Mcp.Tools.ListFailuresOutput");
14
+ const GetFailureContextInputSchema = contractSchema("Mcp.Tools.GetFailureContextInput");
15
+ const GetFailureContextOutputSchema = contractSchema("Mcp.Tools.GetFailureContextOutput");
16
+ const CompareGroupsInputSchema = contractSchema("Mcp.Tools.CompareGroupsInput");
17
+ const CompareGroupsOutputSchema = contractSchema("Mcp.Tools.CompareGroupsOutput");
18
+ const CompareTracesInputSchema = contractSchema("Mcp.Tools.CompareTracesInput");
19
+ const CompareTracesOutputSchema = contractSchema("Mcp.Tools.CompareTracesOutput");
20
+ const VerifyFixInputSchema = contractSchema("Mcp.Tools.VerifyFixInput");
21
+ const VerifyFixOutputSchema = contractSchema("Mcp.Tools.VerifyFixOutput");
22
+ const AggregateTelemetryInputSchema = contractSchema("Mcp.Tools.AggregateTelemetryInput");
23
+ const AggregateTelemetryOutputSchema = contractSchema("Mcp.Tools.AggregateTelemetryOutput");
24
+ const DiscoverAttributesInputSchema = contractSchema("Mcp.Tools.DiscoverAttributesInput");
25
+ const DiscoverAttributesOutputSchema = contractSchema("Mcp.Tools.DiscoverAttributesOutput");
26
+ const GetAgentRunInputSchema = contractSchema("Mcp.Tools.GetAgentRunInput");
27
+ const GetAgentRunOutputSchema = contractSchema("Mcp.Tools.GetAgentRunOutput");
28
+ const ListReleasesInputSchema = contractSchema("Mcp.Tools.ListReleasesInput");
29
+ const ListReleasesOutputSchema = contractSchema("Mcp.Tools.ListReleasesOutput");
30
+ const GetServiceMapInputSchema = contractSchema("Mcp.Tools.GetServiceMapInput");
31
+ const GetServiceMapOutputSchema = contractSchema("Mcp.Tools.GetServiceMapOutput");
32
+ const CheckTelemetryHealthInputSchema = contractSchema("Mcp.Tools.CheckTelemetryHealthInput");
33
+ const CheckTelemetryHealthOutputSchema = contractSchema("Mcp.Tools.CheckTelemetryHealthOutput");
34
+ const GetMcpStatsInputSchema = contractSchema("Mcp.Tools.GetMcpStatsInput");
35
+ const GetMcpStatsOutputSchema = contractSchema("Mcp.Tools.GetMcpStatsOutput");
36
+ const UpdateFailureStatusInputSchema = contractSchema("Mcp.Tools.UpdateFailureStatusInput");
37
+ const UpdateFailureStatusOutputSchema = contractSchema("Mcp.Tools.UpdateFailureStatusOutput");
38
+ const FAILURE_WRITE_SCOPES = [QYL_MCP_SCOPE, QYL_MCP_WRITE_SCOPE];
39
+ export function registerAnalysisTools(server) {
40
+ server.registerTool("triage", {
41
+ title: "Triage",
42
+ description: "Rank new or worsening failures, performance regressions, releases and silent services when investigating what changed.",
43
+ inputSchema: TriageInputSchema,
44
+ outputSchema: compactOutputSchema(TriageOutputSchema),
45
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
46
+ _meta: TELEMETRY_TOOL_AUTH_META,
47
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("triage", args, TriageOutputSchema, scope)));
48
+ server.registerTool("list_failures", {
49
+ title: "List Failures",
50
+ description: "List failures grouped by stable fingerprints when investigating recurring errors or their recorded status.",
51
+ inputSchema: ListFailuresInputSchema,
52
+ outputSchema: compactOutputSchema(ListFailuresOutputSchema),
53
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
54
+ _meta: TELEMETRY_TOOL_AUTH_META,
55
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("list_failures", args, ListFailuresOutputSchema, scope)));
56
+ server.registerTool("get_failure_context", {
57
+ title: "Get Failure Context",
58
+ description: "Return the recorded failure path, correlated logs and comparison evidence when investigating a failed execution.",
59
+ inputSchema: GetFailureContextInputSchema,
60
+ outputSchema: compactOutputSchema(GetFailureContextOutputSchema),
61
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
62
+ _meta: TELEMETRY_TOOL_AUTH_META,
63
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("get_failure_context", args, GetFailureContextOutputSchema, scope)));
64
+ server.registerTool("compare_groups", {
65
+ title: "Compare Groups",
66
+ description: "Compare attribute distributions and durations between two telemetry groups when identifying associations with a failure.",
67
+ inputSchema: CompareGroupsInputSchema,
68
+ outputSchema: compactOutputSchema(CompareGroupsOutputSchema),
69
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
70
+ _meta: TELEMETRY_TOOL_AUTH_META,
71
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("compare_groups", args, CompareGroupsOutputSchema, scope)));
72
+ server.registerTool("compare_traces", {
73
+ title: "Compare Traces",
74
+ description: "Align two executions and locate their first divergence when comparing a failing path with another execution.",
75
+ inputSchema: CompareTracesInputSchema,
76
+ outputSchema: compactOutputSchema(CompareTracesOutputSchema),
77
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
78
+ _meta: TELEMETRY_TOOL_AUTH_META,
79
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("compare_traces", args, CompareTracesOutputSchema, scope)));
80
+ server.registerTool("verify_fix", {
81
+ title: "Verify Fix",
82
+ description: "Measure failure recurrence and traffic after a change when checking whether enough evidence supports a fix.",
83
+ inputSchema: VerifyFixInputSchema,
84
+ outputSchema: compactOutputSchema(VerifyFixOutputSchema),
85
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
86
+ _meta: TELEMETRY_TOOL_AUTH_META,
87
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("verify_fix", args, VerifyFixOutputSchema, scope)));
88
+ server.registerTool("aggregate_telemetry", {
89
+ title: "Aggregate Telemetry",
90
+ description: "Group spans or logs and calculate counts, error rates and durations when comparing operations or attributes.",
91
+ inputSchema: AggregateTelemetryInputSchema,
92
+ outputSchema: compactOutputSchema(AggregateTelemetryOutputSchema),
93
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
94
+ _meta: TELEMETRY_TOOL_AUTH_META,
95
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("aggregate_telemetry", args, AggregateTelemetryOutputSchema, scope)));
96
+ server.registerTool("discover_attributes", {
97
+ title: "Discover Attributes",
98
+ description: "List recorded attribute keys, value distributions and convention descriptions when choosing telemetry filters.",
99
+ inputSchema: DiscoverAttributesInputSchema,
100
+ outputSchema: compactOutputSchema(DiscoverAttributesOutputSchema),
101
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
102
+ _meta: TELEMETRY_TOOL_AUTH_META,
103
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("discover_attributes", args, DiscoverAttributesOutputSchema, scope)));
104
+ server.registerTool("get_agent_run", {
105
+ title: "Get Agent Run",
106
+ description: "Reconstruct agent and tool execution steps, token usage and repeated calls when investigating an agent run.",
107
+ inputSchema: GetAgentRunInputSchema,
108
+ outputSchema: compactOutputSchema(GetAgentRunOutputSchema),
109
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
110
+ _meta: TELEMETRY_TOOL_AUTH_META,
111
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("get_agent_run", args, GetAgentRunOutputSchema, scope)));
112
+ server.registerTool("list_releases", {
113
+ title: "List Releases",
114
+ description: "List observed service versions and their before-and-after impact when investigating a release.",
115
+ inputSchema: ListReleasesInputSchema,
116
+ outputSchema: compactOutputSchema(ListReleasesOutputSchema),
117
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
118
+ _meta: TELEMETRY_TOOL_AUTH_META,
119
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("list_releases", args, ListReleasesOutputSchema, scope)));
120
+ server.registerTool("get_service_map", {
121
+ title: "Get Service Map",
122
+ description: "Return service dependencies and their traffic, error rates and latency when investigating calls between services.",
123
+ inputSchema: GetServiceMapInputSchema,
124
+ outputSchema: compactOutputSchema(GetServiceMapOutputSchema),
125
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
126
+ _meta: TELEMETRY_TOOL_AUTH_META,
127
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("get_service_map", args, GetServiceMapOutputSchema, scope)));
128
+ server.registerTool("check_telemetry_health", {
129
+ title: "Check Telemetry Health",
130
+ description: "Report silent services, orphan spans and missing convention attributes when checking telemetry coverage.",
131
+ inputSchema: CheckTelemetryHealthInputSchema,
132
+ outputSchema: compactOutputSchema(CheckTelemetryHealthOutputSchema),
133
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
134
+ _meta: TELEMETRY_TOOL_AUTH_META,
135
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("check_telemetry_health", args, CheckTelemetryHealthOutputSchema, scope)));
136
+ server.registerTool("get_mcp_stats", {
137
+ title: "Get MCP Stats",
138
+ description: "Return MCP request totals, failure classes and latency aggregates when investigating MCP tool health.",
139
+ inputSchema: GetMcpStatsInputSchema,
140
+ outputSchema: compactOutputSchema(GetMcpStatsOutputSchema),
141
+ annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
142
+ _meta: TELEMETRY_TOOL_AUTH_META,
143
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("get_mcp_stats", args, GetMcpStatsOutputSchema, scope)));
144
+ server.registerTool("update_failure_status", {
145
+ title: "Update Failure Status",
146
+ description: "Set a failure's status or assignee when recording triage decisions, returning the stored failure available through list_failures.",
147
+ inputSchema: UpdateFailureStatusInputSchema,
148
+ outputSchema: compactOutputSchema(UpdateFailureStatusOutputSchema),
149
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
150
+ scopeChallenge: toolScopeChallenge("update_failure_status", FAILURE_WRITE_SCOPES),
151
+ _meta: { securitySchemes: [{ type: "oauth2", scopes: [...FAILURE_WRITE_SCOPES] }] },
152
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => {
153
+ assertToolScopes("update_failure_status", FAILURE_WRITE_SCOPES, ctx.http?.authInfo);
154
+ const { failure_id, etag, ...changes } = args;
155
+ const path = `/api/v1/failures/${encodeURIComponent(failure_id)}`;
156
+ const response = await collectorPatch(path, changes, {
157
+ ...scope.collector,
158
+ headers: { ...scope.collector.headers, ...ifMatch(etag) },
159
+ });
160
+ const output = parseCollectorBody(response, path, UpdateFailureStatusOutputSchema);
161
+ await scope.step("Failure status saved");
162
+ return telemetryToolResult("Failure status saved; list_failures returns the current failure.", output);
163
+ }));
164
+ }
165
+ //# sourceMappingURL=analysis-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis-tools.js","sourceRoot":"","sources":["../src/analysis-tools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,oCAAoC,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,iBAAiB,GAAG,cAAc,CAAC,uBAAuB,CAAC,CAAC;AAClE,MAAM,kBAAkB,GAAG,cAAc,CAAC,wBAAwB,CAAC,CAAC;AACpE,MAAM,uBAAuB,GAAG,cAAc,CAAC,6BAA6B,CAAC,CAAC;AAC9E,MAAM,wBAAwB,GAAG,cAAc,CAAC,8BAA8B,CAAC,CAAC;AAChF,MAAM,4BAA4B,GAAG,cAAc,CAAC,kCAAkC,CAAC,CAAC;AACxF,MAAM,6BAA6B,GAAG,cAAc,CAAC,mCAAmC,CAAC,CAAC;AAC1F,MAAM,wBAAwB,GAAG,cAAc,CAAC,8BAA8B,CAAC,CAAC;AAChF,MAAM,yBAAyB,G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AE,CAAC,EAAE;KACpF,EACD,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAC7C,gBAAgB,CAAC,uBAAuB,EAAE,oBAAoB,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACpF,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;QAC9C,MAAM,IAAI,GAAG,oBAAoB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClE,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE;YACnD,GAAG,KAAK,CAAC,SAAS;YAClB,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE;SAC1D,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,EAAE,IAAI,EAAE,+BAA+B,CAAC,CAAC;QACnF,MAAM,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACzC,OAAO,mBAAmB,CAAC,kEAAkE,EAAE,MAAM,CAAC,CAAC;IACzG,CAAC,CAAC,CACH,CAAC;AAEJ,CAAC"}
package/dist/ci.d.ts CHANGED
@@ -21,5 +21,5 @@ export declare function filterCiSessions(sessions: QylSession[], servicePrefix?:
21
21
  export declare function collectCiPhases(traces: QylTrace[], servicePrefix?: string): CiPhase[];
22
22
  export declare function summarizeCiRuns(runs: CiRunSummary[], mode: Mode, servicePrefix?: string): string;
23
23
  export declare function summarizeCiRun(runId: string, phases: CiPhase[], mode: Mode, servicePrefix?: string): string;
24
- /** Register the CI dogfooding block. */
24
+ /** Query all matching CI telemetry before pagination. */
25
25
  export declare function registerCiTools(server: McpServer): void;
package/dist/ci.js CHANGED
@@ -1,7 +1,6 @@
1
- import { CiLogInputSchema, CiLogOutputSchema, compactOutputSchema, } from "./contract-validation.js";
2
- import { fetchSessions, fetchSessionTraces } from "./data.js";
1
+ import { compactOutputSchema, contractSchema } from "./contract-validation.js";
2
+ import { queryAnalysis } from "./analysis-client.js";
3
3
  import { runTool } from "./request-scope.js";
4
- import { telemetryToolResult } from "./telemetry-redaction.js";
5
4
  import { READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS, TELEMETRY_TOOL_AUTH_META } from "./tools.js";
6
5
  /** Resource service-name prefix that marks telemetry as CI-emitted. */
7
6
  export const CI_SERVICE_PREFIX = "qyl-ci";
@@ -67,51 +66,15 @@ export function summarizeCiRun(runId, phases, mode, servicePrefix = CI_SERVICE_P
67
66
  }
68
67
  return `CI run ${runId} (${mode} mode):\n${lines.join("\n")}`;
69
68
  }
70
- /** Register the CI dogfooding block. */
69
+ /** Query all matching CI telemetry before pagination. */
71
70
  export function registerCiTools(server) {
72
71
  server.registerTool("ci_log", {
73
72
  title: "CI Log",
74
- description: "Read CI telemetry from qyl when the user wants recent runs or a per-leg " +
75
- "phase breakdown with failures first. Any CI can emit this convention: " +
76
- `resource service.name starts with service_prefix (default '${CI_SERVICE_PREFIX}'), session.id identifies ` +
77
- "the run, and one span per phase carries a ci.leg attribute; failed phases " +
78
- "set span status to error. Without run_id, filters the 50 most recent " +
79
- "sessions and returns up to limit matching runs (default 10). With run_id, " +
80
- "reads up to 100 traces for that session and returns only phases matching " +
81
- "the same case-sensitive service prefix; phase output can be large.",
82
- inputSchema: CiLogInputSchema,
83
- outputSchema: compactOutputSchema(CiLogOutputSchema),
73
+ description: "List or compare CI runs and phase failures when investigating a build or test regression.",
74
+ inputSchema: contractSchema("Mcp.Tools.CiLogInput"),
75
+ outputSchema: compactOutputSchema(contractSchema("Mcp.Tools.CiLogOutput")),
84
76
  annotations: READ_ONLY_TELEMETRY_TOOL_ANNOTATIONS,
85
77
  _meta: TELEMETRY_TOOL_AUTH_META,
86
- }, (args, ctx) =>
87
- // A run breakdown is two units a client can watch: the collector round
88
- // trip for the run's traces, then the flatten into per-leg phases. The
89
- // run list is one round trip.
90
- runTool(ctx, args.run_id ? 2 : 1, async (scope) => {
91
- const servicePrefix = args.service_prefix ?? CI_SERVICE_PREFIX;
92
- if (args.run_id) {
93
- const { traces, mode } = await fetchSessionTraces(args.run_id, 100, scope.collector);
94
- await scope.step(`Fetched ${traces.length} trace(s) of CI run ${args.run_id}`);
95
- const phases = collectCiPhases(traces, servicePrefix);
96
- const legs = new Set(phases.map((phase) => phase.leg)).size;
97
- await scope.step(`Collected ${phases.length} phase(s) across ${legs} leg(s)`);
98
- const output = { run_id: args.run_id, phases, mode };
99
- return telemetryToolResult(summarizeCiRun(args.run_id, phases, mode, servicePrefix), output);
100
- }
101
- const { sessions, mode } = await fetchSessions({ limit: 50 }, scope.collector);
102
- const runs = filterCiSessions(sessions, servicePrefix)
103
- .slice(0, args.limit ?? 10)
104
- .map((session) => ({
105
- run_id: session["session_id"],
106
- state: session.state,
107
- start_time: session.start_time,
108
- ...(session.duration_ms === undefined ? {} : { duration_ms: session.duration_ms }),
109
- error_count: session.error_count,
110
- services: session.services,
111
- }));
112
- await scope.step(`Found ${runs.length} CI run(s) among ${sessions.length} session(s)`);
113
- const output = { runs, mode };
114
- return telemetryToolResult(summarizeCiRuns(runs, mode, servicePrefix), output);
115
- }));
78
+ }, (args, ctx) => runTool(ctx, 1, async (scope) => queryAnalysis("ci_log", args, contractSchema("Mcp.Tools.CiLogOutput"), scope)));
116
79
  }
117
80
  //# sourceMappingURL=ci.js.map
package/dist/ci.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ci.js","sourceRoot":"","sources":["../src/ci.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM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,CAAC,QAAQ,EAAE,IAAI,EAAE,cAAc,CAAC,uBAAuB,CAAC,EAAE,KAAK,CAAC,CAAC,CACjF,CAAC;AACJ,CAAC"}
@@ -14,6 +14,12 @@
14
14
  import type { Annotation, CreateAnnotationInput, CreateSavedQueryInput, DeletableKind, ListSavedQueriesInput, RunSavedQueryInput, SavedQuery, SavedQueryRunResult, SessionId, TraceId, UpdateAnnotationInput, UpdateSavedQueryInput } from "@ancplua/qyl-api-schema/types";
15
15
  import { type CollectorRequestOptions } from "./collector.js";
16
16
  import { type ToolScope } from "./request-scope.js";
17
+ /**
18
+ * The If-Match value for a change. An etag is opaque, but it travels as an
19
+ * HTTP field value, so one that could not be sent is refused here instead of
20
+ * failing inside fetch as if the Collector were unreachable.
21
+ */
22
+ export declare function ifMatch(etag: string): Readonly<Record<string, string>>;
17
23
  export declare function createAnnotation(input: CreateAnnotationInput, options: CollectorRequestOptions): Promise<Annotation>;
18
24
  export declare function updateAnnotation(input: UpdateAnnotationInput, options: CollectorRequestOptions): Promise<Annotation>;
19
25
  export declare function createSavedQuery(input: CreateSavedQueryInput, options: CollectorRequestOptions): Promise<SavedQuery>;