@armature-tech/mcp-analytics 0.6.19 → 0.6.20
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/dist/cjs/doctor.d.ts +2 -0
- package/dist/cjs/doctor.js +20 -3
- package/dist/esm/doctor.d.ts +2 -0
- package/dist/esm/doctor.js +18 -2
- package/package.json +1 -1
package/dist/cjs/doctor.d.ts
CHANGED
|
@@ -50,11 +50,13 @@ export type DoctorDependencies = {
|
|
|
50
50
|
};
|
|
51
51
|
export declare const inspectMcp: (options: DoctorOptions) => Promise<McpInspection>;
|
|
52
52
|
export declare const classifyToolInstrumentation: (tool: DoctorTool) => "current" | "legacy" | "owned" | "missing";
|
|
53
|
+
export declare const isSdkOwnedCapabilityTool: (tool: DoctorTool) => boolean;
|
|
53
54
|
export declare const inspectToolCoverage: (tools: DoctorTool[]) => {
|
|
54
55
|
current: string[];
|
|
55
56
|
legacy: string[];
|
|
56
57
|
owned: string[];
|
|
57
58
|
missing: string[];
|
|
59
|
+
sdkOwned: string[];
|
|
58
60
|
total: number;
|
|
59
61
|
};
|
|
60
62
|
export declare const detectLocalSdks: (cwd: string) => Promise<LocalSdk[]>;
|
package/dist/cjs/doctor.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultDoctorOptions = exports.runDoctor = exports.verifyIngest = exports.detectLocalSdks = exports.inspectToolCoverage = exports.classifyToolInstrumentation = exports.inspectMcp = void 0;
|
|
3
|
+
exports.defaultDoctorOptions = exports.runDoctor = exports.verifyIngest = exports.detectLocalSdks = exports.inspectToolCoverage = exports.isSdkOwnedCapabilityTool = exports.classifyToolInstrumentation = exports.inspectMcp = void 0;
|
|
4
4
|
const promises_1 = require("node:fs/promises");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const index_js_1 = require("@modelcontextprotocol/sdk/client/index.js");
|
|
7
7
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
8
8
|
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
9
|
+
const request_capability_js_1 = require("./request-capability.js");
|
|
9
10
|
const DEFAULT_INGEST_URL = "https://app.armature.tech/api/mcp-analytics/ingest";
|
|
10
11
|
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
11
12
|
const CURRENT_TELEMETRY_MARKER = "Conversation telemetry.";
|
|
@@ -127,12 +128,25 @@ const classifyToolInstrumentation = (tool) => {
|
|
|
127
128
|
return ownsTelemetryField ? "owned" : "missing";
|
|
128
129
|
};
|
|
129
130
|
exports.classifyToolInstrumentation = classifyToolInstrumentation;
|
|
131
|
+
// The SDK's own request_capability tool is registered without a telemetry
|
|
132
|
+
// block on purpose (its input is already conversation-derived), so the
|
|
133
|
+
// wrapping check must not count it as an unwrapped customer tool. Match on
|
|
134
|
+
// the exact advertised description as well as the reserved name so a
|
|
135
|
+
// customer-defined tool that merely shadows the name is still checked.
|
|
136
|
+
const isSdkOwnedCapabilityTool = (tool) => tool.name === request_capability_js_1.REQUEST_CAPABILITY_TOOL_NAME
|
|
137
|
+
&& (tool.description || "") === request_capability_js_1.REQUEST_CAPABILITY_DESCRIPTION;
|
|
138
|
+
exports.isSdkOwnedCapabilityTool = isSdkOwnedCapabilityTool;
|
|
130
139
|
const inspectToolCoverage = (tools) => {
|
|
131
140
|
const current = [];
|
|
132
141
|
const legacy = [];
|
|
133
142
|
const owned = [];
|
|
134
143
|
const missing = [];
|
|
144
|
+
const sdkOwned = [];
|
|
135
145
|
for (const tool of tools) {
|
|
146
|
+
if ((0, exports.isSdkOwnedCapabilityTool)(tool)) {
|
|
147
|
+
sdkOwned.push(tool.name);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
136
150
|
const classification = (0, exports.classifyToolInstrumentation)(tool);
|
|
137
151
|
if (classification === "current")
|
|
138
152
|
current.push(tool.name);
|
|
@@ -143,7 +157,7 @@ const inspectToolCoverage = (tools) => {
|
|
|
143
157
|
else
|
|
144
158
|
missing.push(tool.name);
|
|
145
159
|
}
|
|
146
|
-
return { current, legacy, owned, missing, total: tools.length };
|
|
160
|
+
return { current, legacy, owned, missing, sdkOwned, total: tools.length - sdkOwned.length };
|
|
147
161
|
};
|
|
148
162
|
exports.inspectToolCoverage = inspectToolCoverage;
|
|
149
163
|
const readIfPresent = async (path) => {
|
|
@@ -279,7 +293,10 @@ const runDoctor = async (options, dependencies = { inspectMcp: exports.inspectMc
|
|
|
279
293
|
checks.push(warn("tool-wrapping", "Tool wrapping", `${coverage.current.length}/${coverage.total} tools expose the current Armature telemetry contract; ${coverage.owned.length} own a top-level telemetry field and are intentionally untouched${sample ? `: ${sample}` : ""}.`, "Rename the tool-owned telemetry input if you want Armature analytics for that tool, then restart the MCP server."));
|
|
280
294
|
}
|
|
281
295
|
else {
|
|
282
|
-
checks.push(pass("tool-wrapping", "Tool wrapping", `All ${coverage.total} tools expose the current Armature telemetry contract.`
|
|
296
|
+
checks.push(pass("tool-wrapping", "Tool wrapping", `All ${coverage.total} tools expose the current Armature telemetry contract.`
|
|
297
|
+
+ (coverage.sdkOwned.length > 0
|
|
298
|
+
? ` The SDK-owned ${coverage.sdkOwned.join(", ")} tool carries no telemetry block by design and is exempt.`
|
|
299
|
+
: "")));
|
|
283
300
|
}
|
|
284
301
|
}
|
|
285
302
|
}
|
package/dist/esm/doctor.d.ts
CHANGED
|
@@ -50,11 +50,13 @@ export type DoctorDependencies = {
|
|
|
50
50
|
};
|
|
51
51
|
export declare const inspectMcp: (options: DoctorOptions) => Promise<McpInspection>;
|
|
52
52
|
export declare const classifyToolInstrumentation: (tool: DoctorTool) => "current" | "legacy" | "owned" | "missing";
|
|
53
|
+
export declare const isSdkOwnedCapabilityTool: (tool: DoctorTool) => boolean;
|
|
53
54
|
export declare const inspectToolCoverage: (tools: DoctorTool[]) => {
|
|
54
55
|
current: string[];
|
|
55
56
|
legacy: string[];
|
|
56
57
|
owned: string[];
|
|
57
58
|
missing: string[];
|
|
59
|
+
sdkOwned: string[];
|
|
58
60
|
total: number;
|
|
59
61
|
};
|
|
60
62
|
export declare const detectLocalSdks: (cwd: string) => Promise<LocalSdk[]>;
|
package/dist/esm/doctor.js
CHANGED
|
@@ -3,6 +3,7 @@ import { resolve } from "node:path";
|
|
|
3
3
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
4
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
5
5
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
6
|
+
import { REQUEST_CAPABILITY_DESCRIPTION, REQUEST_CAPABILITY_TOOL_NAME, } from "./request-capability.js";
|
|
6
7
|
const DEFAULT_INGEST_URL = "https://app.armature.tech/api/mcp-analytics/ingest";
|
|
7
8
|
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
8
9
|
const CURRENT_TELEMETRY_MARKER = "Conversation telemetry.";
|
|
@@ -122,12 +123,24 @@ export const classifyToolInstrumentation = (tool) => {
|
|
|
122
123
|
}
|
|
123
124
|
return ownsTelemetryField ? "owned" : "missing";
|
|
124
125
|
};
|
|
126
|
+
// The SDK's own request_capability tool is registered without a telemetry
|
|
127
|
+
// block on purpose (its input is already conversation-derived), so the
|
|
128
|
+
// wrapping check must not count it as an unwrapped customer tool. Match on
|
|
129
|
+
// the exact advertised description as well as the reserved name so a
|
|
130
|
+
// customer-defined tool that merely shadows the name is still checked.
|
|
131
|
+
export const isSdkOwnedCapabilityTool = (tool) => tool.name === REQUEST_CAPABILITY_TOOL_NAME
|
|
132
|
+
&& (tool.description || "") === REQUEST_CAPABILITY_DESCRIPTION;
|
|
125
133
|
export const inspectToolCoverage = (tools) => {
|
|
126
134
|
const current = [];
|
|
127
135
|
const legacy = [];
|
|
128
136
|
const owned = [];
|
|
129
137
|
const missing = [];
|
|
138
|
+
const sdkOwned = [];
|
|
130
139
|
for (const tool of tools) {
|
|
140
|
+
if (isSdkOwnedCapabilityTool(tool)) {
|
|
141
|
+
sdkOwned.push(tool.name);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
131
144
|
const classification = classifyToolInstrumentation(tool);
|
|
132
145
|
if (classification === "current")
|
|
133
146
|
current.push(tool.name);
|
|
@@ -138,7 +151,7 @@ export const inspectToolCoverage = (tools) => {
|
|
|
138
151
|
else
|
|
139
152
|
missing.push(tool.name);
|
|
140
153
|
}
|
|
141
|
-
return { current, legacy, owned, missing, total: tools.length };
|
|
154
|
+
return { current, legacy, owned, missing, sdkOwned, total: tools.length - sdkOwned.length };
|
|
142
155
|
};
|
|
143
156
|
const readIfPresent = async (path) => {
|
|
144
157
|
try {
|
|
@@ -271,7 +284,10 @@ export const runDoctor = async (options, dependencies = { inspectMcp, detectLoca
|
|
|
271
284
|
checks.push(warn("tool-wrapping", "Tool wrapping", `${coverage.current.length}/${coverage.total} tools expose the current Armature telemetry contract; ${coverage.owned.length} own a top-level telemetry field and are intentionally untouched${sample ? `: ${sample}` : ""}.`, "Rename the tool-owned telemetry input if you want Armature analytics for that tool, then restart the MCP server."));
|
|
272
285
|
}
|
|
273
286
|
else {
|
|
274
|
-
checks.push(pass("tool-wrapping", "Tool wrapping", `All ${coverage.total} tools expose the current Armature telemetry contract.`
|
|
287
|
+
checks.push(pass("tool-wrapping", "Tool wrapping", `All ${coverage.total} tools expose the current Armature telemetry contract.`
|
|
288
|
+
+ (coverage.sdkOwned.length > 0
|
|
289
|
+
? ` The SDK-owned ${coverage.sdkOwned.join(", ")} tool carries no telemetry block by design and is exempt.`
|
|
290
|
+
: "")));
|
|
275
291
|
}
|
|
276
292
|
}
|
|
277
293
|
}
|