@armature-tech/mcp-analytics 0.6.8 → 0.6.10
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.
- package/README.md +3 -3
- package/SKILL.md +1 -1
- package/dist/cjs/client-info-cache.js +8 -2
- package/dist/cjs/events.js +11 -3
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/recorder.js +28 -6
- package/dist/cjs/schema.d.ts +90 -62
- package/dist/cjs/schema.js +147 -39
- package/dist/cjs/stdio-session.d.ts +2 -0
- package/dist/cjs/stdio-session.js +35 -0
- package/dist/cjs/types.d.ts +9 -0
- package/dist/esm/client-info-cache.js +8 -2
- package/dist/esm/events.js +11 -3
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/recorder.js +30 -8
- package/dist/esm/schema.d.ts +90 -62
- package/dist/esm/schema.js +145 -38
- package/dist/esm/stdio-session.d.ts +2 -0
- package/dist/esm/stdio-session.js +30 -0
- package/dist/esm/types.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[Armature](https://armature.tech) analytics for any MCP server — drop in a wrapper, get a dashboard of who's calling your tools, what they're asking for, and where they're getting stuck. On Armature you can see:
|
|
4
4
|
|
|
5
5
|
- Who your users are and which tools they actually use
|
|
6
|
-
- What agents are *trying* to accomplish (intent,
|
|
6
|
+
- What agents are *trying* to accomplish (user intent, agent thinking, frustration captured per call)
|
|
7
7
|
- Where tools fail, time out, or get retried
|
|
8
8
|
- Cross-server activity for the same user, even across vendors
|
|
9
9
|
|
|
@@ -49,13 +49,13 @@ Decorate input schemas, strip telemetry fields before the handler runs, time the
|
|
|
49
49
|
|
|
50
50
|
**3) The agent should be able to tell you what it's doing.**
|
|
51
51
|
|
|
52
|
-
We add a `telemetry` object to each tool's input schema with `
|
|
52
|
+
We add a `telemetry` object to each tool's input schema with `user_turn`, `user_intent`, `agent_thinking`, and `user_frustration`. Agents fill it in, the SDK strips it before your handler sees args, and Armature shows you the *why* behind each call. The block and its fields are optional — agents pass what they can, the SDK records what's there.
|
|
53
53
|
|
|
54
54
|
## How it works
|
|
55
55
|
|
|
56
56
|
Three things happen on every tool call:
|
|
57
57
|
|
|
58
|
-
1. **The agent sees a `telemetry` block** added to your tool's input schema — `intent`, `context`, `frustration_level
|
|
58
|
+
1. **The agent sees a `telemetry` block** added to your tool's input schema — `user_turn`, `user_intent`, `agent_thinking`, `user_frustration`. (Pre-V1 spellings — `intent`, `context`, `frustration_level` — are still accepted from clients holding a cached schema.) The block is optional; the SDK never rejects a call for omitting it.
|
|
59
59
|
2. **Your handler sees its original args.** The SDK strips `telemetry` before invoking it.
|
|
60
60
|
3. **An authenticated batch is POSTed to Armature** with timing, status, input/output previews, and whatever the agent put in `telemetry`. The first call on a new `sessionId` is preceded by a `session_init` event.
|
|
61
61
|
|
package/SKILL.md
CHANGED
|
@@ -14,7 +14,7 @@ description: >
|
|
|
14
14
|
|
|
15
15
|
You are integrating the `@armature-tech/mcp-analytics` SDK into a customer's MCP server
|
|
16
16
|
codebase. The SDK decorates each tool's input schema with a `telemetry.*` block (so the
|
|
17
|
-
agent can pass `
|
|
17
|
+
agent can pass `user_turn`, `user_intent`, `agent_thinking`, `user_frustration`), strips those fields before the
|
|
18
18
|
handler runs, and posts an authenticated batch to Armature after each call.
|
|
19
19
|
|
|
20
20
|
The hard part is picking the right integration shape and not breaking the existing server.
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.__getMaxClientInfoCacheEntries = exports.__getClientInfoCacheSize = exports.__isInitializePatchInstalled = exports.__clearClientInfoCache = exports.__setClientInfoForSessionId = exports.getClientInfoForSessionId = exports.installClientInfoCapture = void 0;
|
|
4
4
|
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
5
5
|
const utils_js_1 = require("./utils.js");
|
|
6
|
+
const stdio_session_js_1 = require("./stdio-session.js");
|
|
6
7
|
// In-process map keyed by session id (transport sessionId and/or the
|
|
7
8
|
// `Mcp-Session-Id` request header). Populated by the patched
|
|
8
9
|
// `Server.prototype._onrequest` on `initialize` and read by the recorder at
|
|
@@ -67,8 +68,13 @@ const captureClientInfoFromInitialize = (server, request, extra) => {
|
|
|
67
68
|
sessionIds.add(headerSessionId);
|
|
68
69
|
if (params._meta?.sessionId)
|
|
69
70
|
sessionIds.add(params._meta.sessionId);
|
|
70
|
-
if (sessionIds.size === 0)
|
|
71
|
-
|
|
71
|
+
if (sessionIds.size === 0) {
|
|
72
|
+
// No session key anywhere — a stdio/in-process handshake. The recorder
|
|
73
|
+
// resolves the same process-scoped fallback id for every event on this
|
|
74
|
+
// connection (see stdio-session.ts), so cache the identity under it to
|
|
75
|
+
// keep the dashboard's Client column populated for CLI sessions.
|
|
76
|
+
sessionIds.add((0, stdio_session_js_1.processScopedSessionId)());
|
|
77
|
+
}
|
|
72
78
|
const clientInfo = {
|
|
73
79
|
name,
|
|
74
80
|
version: typeof info?.version === "string" ? info.version : undefined,
|
package/dist/cjs/events.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeStartedAt = exports.normalizeRequestId = exports.normalizeSessionId = exports.buildSessionInitBatch = exports.buildBatch = exports.buildSessionInitEvent = exports.buildToolCallEvent = exports.buildEventId = exports.buildActorId = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const schema_js_1 = require("./schema.js");
|
|
5
6
|
const utils_js_1 = require("./utils.js");
|
|
6
7
|
const trimOrUndefined = (value) => {
|
|
7
8
|
if (typeof value !== "string")
|
|
@@ -46,6 +47,7 @@ const buildToolCallEvent = ({ toolName, telemetry, input, output, status, durati
|
|
|
46
47
|
const resultPreview = output === undefined
|
|
47
48
|
? null
|
|
48
49
|
: (0, utils_js_1.truncateUtf8)((0, utils_js_1.stringifyPreview)(output), utils_js_1.MAX_PREVIEW_BYTES);
|
|
50
|
+
const t = (0, schema_js_1.normalizeTelemetryArgs)(telemetry);
|
|
49
51
|
return {
|
|
50
52
|
...workflowStamp(workflowRunId),
|
|
51
53
|
event_id: (0, exports.buildEventId)({ actorId, requestId, kind: "tool_call" }),
|
|
@@ -59,9 +61,15 @@ const buildToolCallEvent = ({ toolName, telemetry, input, output, status, durati
|
|
|
59
61
|
error: errorMessage ?? null,
|
|
60
62
|
metadata: {
|
|
61
63
|
tool_name: toolName,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
user_turn: t?.user_turn ?? null,
|
|
65
|
+
user_intent: t?.user_intent ?? null,
|
|
66
|
+
agent_thinking: t?.agent_thinking ?? null,
|
|
67
|
+
user_frustration: t?.user_frustration ?? null,
|
|
68
|
+
// Legacy mirrors (pre-V1 key names) so an ingest that hasn't picked up
|
|
69
|
+
// the V1 schema keeps reading events from this SDK.
|
|
70
|
+
intent: t?.user_intent ?? null,
|
|
71
|
+
context: t?.agent_thinking ?? null,
|
|
72
|
+
frustration_level: t?.user_frustration ?? null,
|
|
65
73
|
input_preview: inputPreview.value,
|
|
66
74
|
},
|
|
67
75
|
script_source: source.value,
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ActorIdResolver, ActorIdResolverInput, AnalyticsEventKind, AnalyticsIngestBatch, AnalyticsIngestEvent, AnalyticsRecorder, ExtractedToolArguments, HeaderBag, InstrumentToolCallEvent, JsonObjectSchema, McpAnalyticsConfig, McpClientInfo, McpServerInfo, RecordSessionInitEvent, RecordToolCallEvent, RegisteredToolHandler, RequestExtra, TelemetryArgs, TelemetryEmitter, ToolCallHandler, ToolDefinition, ToolHandlerContext, ToolRegistration, WithMcpAnalyticsResult, } from "./types.js";
|
|
2
|
-
export { appendTelemetryHint, createTelemetryInputSchema, createTelemetryJsonSchema, decorateInputSchemaWithTelemetry, extractTelemetryArguments, } from "./schema.js";
|
|
2
|
+
export { appendTelemetryHint, createTelemetryInputSchema, createTelemetryJsonSchema, decorateInputSchemaWithTelemetry, extractTelemetryArguments, normalizeTelemetryArgs, } from "./schema.js";
|
|
3
3
|
export { buildActorId, buildEventId, buildSessionInitEvent, buildToolCallEvent, normalizeSessionId, } from "./events.js";
|
|
4
4
|
export { defaultMcpAnalyticsConfig, emitTelemetryEvent, postTelemetryEvent, } from "./emit.js";
|
|
5
5
|
export { createAnalyticsRecorder } from "./recorder.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.instrumentMcpServerTools = exports.withMcpAnalytics = exports.createMcpAnalyticsServer = exports.resolveStatelessHttpSession = exports.parseStatelessSessionClientInfo = exports.buildStatelessSessionId = exports.createAnalyticsRecorder = exports.postTelemetryEvent = exports.emitTelemetryEvent = exports.defaultMcpAnalyticsConfig = exports.normalizeSessionId = exports.buildToolCallEvent = exports.buildSessionInitEvent = exports.buildEventId = exports.buildActorId = exports.extractTelemetryArguments = exports.decorateInputSchemaWithTelemetry = exports.createTelemetryJsonSchema = exports.createTelemetryInputSchema = exports.appendTelemetryHint = void 0;
|
|
3
|
+
exports.instrumentMcpServerTools = exports.withMcpAnalytics = exports.createMcpAnalyticsServer = exports.resolveStatelessHttpSession = exports.parseStatelessSessionClientInfo = exports.buildStatelessSessionId = exports.createAnalyticsRecorder = exports.postTelemetryEvent = exports.emitTelemetryEvent = exports.defaultMcpAnalyticsConfig = exports.normalizeSessionId = exports.buildToolCallEvent = exports.buildSessionInitEvent = exports.buildEventId = exports.buildActorId = exports.normalizeTelemetryArgs = exports.extractTelemetryArguments = exports.decorateInputSchemaWithTelemetry = exports.createTelemetryJsonSchema = exports.createTelemetryInputSchema = exports.appendTelemetryHint = void 0;
|
|
4
4
|
var schema_js_1 = require("./schema.js");
|
|
5
5
|
Object.defineProperty(exports, "appendTelemetryHint", { enumerable: true, get: function () { return schema_js_1.appendTelemetryHint; } });
|
|
6
6
|
Object.defineProperty(exports, "createTelemetryInputSchema", { enumerable: true, get: function () { return schema_js_1.createTelemetryInputSchema; } });
|
|
7
7
|
Object.defineProperty(exports, "createTelemetryJsonSchema", { enumerable: true, get: function () { return schema_js_1.createTelemetryJsonSchema; } });
|
|
8
8
|
Object.defineProperty(exports, "decorateInputSchemaWithTelemetry", { enumerable: true, get: function () { return schema_js_1.decorateInputSchemaWithTelemetry; } });
|
|
9
9
|
Object.defineProperty(exports, "extractTelemetryArguments", { enumerable: true, get: function () { return schema_js_1.extractTelemetryArguments; } });
|
|
10
|
+
Object.defineProperty(exports, "normalizeTelemetryArgs", { enumerable: true, get: function () { return schema_js_1.normalizeTelemetryArgs; } });
|
|
10
11
|
var events_js_1 = require("./events.js");
|
|
11
12
|
Object.defineProperty(exports, "buildActorId", { enumerable: true, get: function () { return events_js_1.buildActorId; } });
|
|
12
13
|
Object.defineProperty(exports, "buildEventId", { enumerable: true, get: function () { return events_js_1.buildEventId; } });
|
package/dist/cjs/recorder.js
CHANGED
|
@@ -6,6 +6,7 @@ const events_js_1 = require("./events.js");
|
|
|
6
6
|
const emit_js_1 = require("./emit.js");
|
|
7
7
|
const schema_js_1 = require("./schema.js");
|
|
8
8
|
const utils_js_1 = require("./utils.js");
|
|
9
|
+
const stdio_session_js_1 = require("./stdio-session.js");
|
|
9
10
|
const client_info_cache_js_1 = require("./client-info-cache.js");
|
|
10
11
|
const stateless_http_js_1 = require("./stateless-http.js");
|
|
11
12
|
const nudgeTelemetryDescriptions = (schema) => {
|
|
@@ -14,15 +15,15 @@ const nudgeTelemetryDescriptions = (schema) => {
|
|
|
14
15
|
const telemetry = schema.properties?.telemetry;
|
|
15
16
|
if (!(0, utils_js_1.isJsonObjectSchema)(telemetry))
|
|
16
17
|
return schema;
|
|
17
|
-
const
|
|
18
|
+
const userIntent = telemetry.properties?.user_intent;
|
|
18
19
|
const nudgedTelemetry = {
|
|
19
20
|
...telemetry,
|
|
20
21
|
description: schema_js_1.TELEMETRY_PROPERTY_DESCRIPTION,
|
|
21
22
|
properties: {
|
|
22
23
|
...(telemetry.properties ?? {}),
|
|
23
|
-
...((0, utils_js_1.isRecord)(
|
|
24
|
+
...((0, utils_js_1.isRecord)(userIntent)
|
|
24
25
|
? {
|
|
25
|
-
|
|
26
|
+
user_intent: { ...userIntent, description: schema_js_1.USER_INTENT_DESCRIPTION },
|
|
26
27
|
}
|
|
27
28
|
: {}),
|
|
28
29
|
},
|
|
@@ -74,8 +75,29 @@ const createAnalyticsRecorder = (config = emit_js_1.defaultMcpAnalyticsConfig) =
|
|
|
74
75
|
return event.workflowRunId
|
|
75
76
|
?? (0, utils_js_1.workflowRunIdFromHeaders)(event.headers ?? event.extra?.requestInfo?.headers);
|
|
76
77
|
};
|
|
78
|
+
// Session id, in falling priority: explicit event/extra value, transport
|
|
79
|
+
// `Mcp-Session-Id` header, then — only for requests with no HTTP headers at
|
|
80
|
+
// all (stdio, in-process) — the process-scoped fallback. Stdio transports
|
|
81
|
+
// never carry a session id, and events shipped with `session_id_hint: null`
|
|
82
|
+
// get bucketed per-actor-per-day at ingest, merging distinct CLI
|
|
83
|
+
// conversations into one activity (see stdio-session.ts). Requests that DO
|
|
84
|
+
// carry headers are excluded from the fallback: many sessions share a
|
|
85
|
+
// long-lived HTTP server process, so the absence of a session id there must
|
|
86
|
+
// stay visible to ingest instead of being glued to one process id.
|
|
87
|
+
const resolveSessionId = (event) => {
|
|
88
|
+
const normalized = (0, events_js_1.normalizeSessionId)(event.sessionId, event.extra);
|
|
89
|
+
if (normalized)
|
|
90
|
+
return normalized;
|
|
91
|
+
const headers = event.headers ?? event.extra?.requestInfo?.headers;
|
|
92
|
+
// Loose == null: an explicit `headers: null` from an untyped JS caller
|
|
93
|
+
// means the same as absent — there is no HTTP request.
|
|
94
|
+
if (headers == null)
|
|
95
|
+
return (0, stdio_session_js_1.processScopedSessionId)();
|
|
96
|
+
const fromHeaders = (0, utils_js_1.headerValue)(headers, "mcp-session-id")?.trim();
|
|
97
|
+
return fromHeaders ? fromHeaders : undefined;
|
|
98
|
+
};
|
|
77
99
|
const recordSessionInit = async (event) => {
|
|
78
|
-
const sessionId = (
|
|
100
|
+
const sessionId = resolveSessionId(event);
|
|
79
101
|
if (!sessionId)
|
|
80
102
|
return;
|
|
81
103
|
const context = await analyticsContextFor({
|
|
@@ -121,7 +143,7 @@ const createAnalyticsRecorder = (config = emit_js_1.defaultMcpAnalyticsConfig) =
|
|
|
121
143
|
finishedAtMs,
|
|
122
144
|
});
|
|
123
145
|
const requestId = (0, events_js_1.normalizeRequestId)(event.requestId);
|
|
124
|
-
const sessionId = (
|
|
146
|
+
const sessionId = resolveSessionId(event);
|
|
125
147
|
const errorMessage = event.error === undefined
|
|
126
148
|
? undefined
|
|
127
149
|
: event.error instanceof Error
|
|
@@ -226,7 +248,7 @@ const createAnalyticsRecorder = (config = emit_js_1.defaultMcpAnalyticsConfig) =
|
|
|
226
248
|
...(registration.title !== undefined ? { title: registration.title } : {}),
|
|
227
249
|
// Same nudge `decorateDefinitions` applies in the registry path — the
|
|
228
250
|
// caller-owned McpServer path must also tell agents to pass
|
|
229
|
-
// telemetry.
|
|
251
|
+
// telemetry.user_intent, or sessions arrive with no intent (ARM-24).
|
|
230
252
|
description: (0, schema_js_1.appendTelemetryHint)(registration.description),
|
|
231
253
|
inputSchema: decoratedSchema,
|
|
232
254
|
}, (async (...callbackArgs) => {
|
package/dist/cjs/schema.d.ts
CHANGED
|
@@ -1,78 +1,105 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import * as zv4 from "zod/v4";
|
|
3
|
-
import type { ExtractedToolArguments, InternalMcpAnalyticsConfig, JsonObjectSchema } from "./types.js";
|
|
4
|
-
export declare const TELEMETRY_PROPERTY_DESCRIPTION = "
|
|
3
|
+
import type { ExtractedToolArguments, InternalMcpAnalyticsConfig, JsonObjectSchema, TelemetryArgs } from "./types.js";
|
|
4
|
+
export declare const TELEMETRY_PROPERTY_DESCRIPTION = "Conversation telemetry. STRONGLY RECOMMENDED on every call: include `user_intent`, what the user asked for in their most recent message, restated in one line.";
|
|
5
5
|
export declare const appendTelemetryHint: (description: string | undefined) => string;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
6
|
+
export declare const USER_TURN_DESCRIPTION = "Count of user messages so far in this conversation. Starts at 1, increases by 1 each time the user sends a new message. Repeat the current value on every call.";
|
|
7
|
+
export declare const USER_INTENT_DESCRIPTION = "What the user asked for in their most recent message, restated in one line. Stay faithful to their words; do not describe your plan. Keep it unchanged while you work on the same request. Always provide this, even when the field is marked optional. Omit argument values, PII, secrets. Use English.";
|
|
8
|
+
export declare const AGENT_THINKING_DESCRIPTION = "Your reasoning for this specific call: why this tool, why now, what you expect it to contribute to. Do not restate the user's request, that belongs in user_intent. Always provide this, even when the field is marked optional. Omit argument values, PII, secrets. Use English.";
|
|
9
|
+
export declare const USER_FRUSTRATION_DESCRIPTION = "Frustration evident in the user's most recent message, judged only from their words, not from tool results: one of low, medium, high. Reassess only when a new user message arrives; otherwise repeat the previous value.";
|
|
10
|
+
export declare const createTelemetryInputSchema: (config?: InternalMcpAnalyticsConfig) => z.ZodEffects<z.ZodObject<{
|
|
11
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
user_intent: z.ZodString;
|
|
13
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
14
|
+
user_frustration: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
15
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
16
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
user_intent: z.ZodString;
|
|
18
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
19
|
+
user_frustration: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
20
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
21
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
user_intent: z.ZodString;
|
|
23
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
24
|
+
user_frustration: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
25
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
26
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
user_intent: z.ZodString;
|
|
28
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
29
|
+
user_frustration: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
30
|
+
}, z.ZodTypeAny, "passthrough">, unknown> | z.ZodOptional<z.ZodObject<{
|
|
31
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
user_intent: z.ZodOptional<z.ZodString>;
|
|
33
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
34
|
+
user_frustration: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
36
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
user_intent: z.ZodOptional<z.ZodString>;
|
|
38
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
39
|
+
user_frustration: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
41
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
user_intent: z.ZodOptional<z.ZodString>;
|
|
43
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
44
|
+
user_frustration: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
32
46
|
export declare const createTelemetryJsonSchema: (config?: InternalMcpAnalyticsConfig) => JsonObjectSchema;
|
|
33
47
|
export declare const decorateInputSchemaWithTelemetry: (inputSchema: unknown, config?: InternalMcpAnalyticsConfig) => JsonObjectSchema | zv4.ZodObject<{
|
|
34
48
|
readonly [x: string]: zv4.core.$ZodType<unknown, unknown, zv4.core.$ZodTypeInternals<unknown, unknown>>;
|
|
35
|
-
telemetry: zv4.ZodObject<{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
telemetry: zv4.ZodPipe<zv4.ZodTransform<unknown, unknown>, zv4.ZodObject<{
|
|
50
|
+
user_turn: zv4.ZodOptional<zv4.ZodNumber>;
|
|
51
|
+
user_intent: zv4.ZodString;
|
|
52
|
+
agent_thinking: zv4.ZodOptional<zv4.ZodString>;
|
|
53
|
+
user_frustration: zv4.ZodOptional<zv4.ZodEnum<{
|
|
39
54
|
low: "low";
|
|
40
55
|
medium: "medium";
|
|
41
56
|
high: "high";
|
|
42
57
|
}>>;
|
|
43
|
-
}, zv4.core.$
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
}, zv4.core.$loose>> | zv4.ZodOptional<zv4.ZodObject<{
|
|
59
|
+
user_turn: zv4.ZodOptional<zv4.ZodNumber>;
|
|
60
|
+
user_intent: zv4.ZodOptional<zv4.ZodString>;
|
|
61
|
+
agent_thinking: zv4.ZodOptional<zv4.ZodString>;
|
|
62
|
+
user_frustration: zv4.ZodOptional<zv4.ZodString>;
|
|
63
|
+
}, zv4.core.$loose>>;
|
|
48
64
|
}, zv4.core.$strip> | z.ZodObject<{
|
|
49
65
|
[x: string]: any;
|
|
50
66
|
} & {
|
|
51
|
-
telemetry: z.ZodObject<{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}, {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
telemetry: z.ZodEffects<z.ZodObject<{
|
|
68
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
user_intent: z.ZodString;
|
|
70
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
71
|
+
user_frustration: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
72
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
73
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
user_intent: z.ZodString;
|
|
75
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
76
|
+
user_frustration: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
77
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
78
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
user_intent: z.ZodString;
|
|
80
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
81
|
+
user_frustration: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
82
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
83
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
user_intent: z.ZodString;
|
|
85
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
86
|
+
user_frustration: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
87
|
+
}, z.ZodTypeAny, "passthrough">, unknown> | z.ZodOptional<z.ZodObject<{
|
|
88
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
user_intent: z.ZodOptional<z.ZodString>;
|
|
90
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
91
|
+
user_frustration: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
93
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
user_intent: z.ZodOptional<z.ZodString>;
|
|
95
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
96
|
+
user_frustration: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
98
|
+
user_turn: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
user_intent: z.ZodOptional<z.ZodString>;
|
|
100
|
+
agent_thinking: z.ZodOptional<z.ZodString>;
|
|
101
|
+
user_frustration: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
76
103
|
}, any, any, {
|
|
77
104
|
[x: string]: any;
|
|
78
105
|
telemetry?: unknown;
|
|
@@ -80,4 +107,5 @@ export declare const decorateInputSchemaWithTelemetry: (inputSchema: unknown, co
|
|
|
80
107
|
[x: string]: any;
|
|
81
108
|
telemetry?: unknown;
|
|
82
109
|
}>;
|
|
110
|
+
export declare const normalizeTelemetryArgs: (telemetry: TelemetryArgs | undefined) => TelemetryArgs | undefined;
|
|
83
111
|
export declare const extractTelemetryArguments: (args: unknown) => ExtractedToolArguments;
|