@posthog/mcp 0.0.6 → 0.0.7
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 +1 -0
- package/dist/index.cjs +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +11 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,6 +103,7 @@ Important properties:
|
|
|
103
103
|
- `$mcp_intent_source` as `context_parameter` or `inferred`
|
|
104
104
|
- `$mcp_tool_name` and `$mcp_resource_name`
|
|
105
105
|
- `$mcp_tool_description`, the tool's current `description` at the moment of the call — populated on `mcp_tool_call` and on the paired `$exception` event so the description is visible inline while triaging
|
|
106
|
+
- `$mcp_listed_tool_names`, the array of tool names advertised in a `tools/list` response — populated on `mcp_tools_list` events so you can correlate "tools the agent was offered" with "tools the agent actually called" (e.g. find advertised tools that never get picked)
|
|
106
107
|
- `$mcp_parameters` and `$mcp_response`, after redaction and truncation
|
|
107
108
|
- `$mcp_duration_ms`
|
|
108
109
|
- `$mcp_is_error`
|
package/dist/index.cjs
CHANGED
|
@@ -382,6 +382,7 @@ const PostHogMCPAnalyticsProperty = {
|
|
|
382
382
|
IsError: "$mcp_is_error",
|
|
383
383
|
Intent: "$mcp_intent",
|
|
384
384
|
IntentSource: "$mcp_intent_source",
|
|
385
|
+
ListedToolNames: "$mcp_listed_tool_names",
|
|
385
386
|
Parameters: "$mcp_parameters",
|
|
386
387
|
ResourceName: "$mcp_resource_name",
|
|
387
388
|
Response: "$mcp_response",
|
|
@@ -459,6 +460,7 @@ function addCommonEventProperties(event, properties) {
|
|
|
459
460
|
if (event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolName] = event.resourceName;
|
|
460
461
|
}
|
|
461
462
|
if (event.toolDescription && event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolDescription] = event.toolDescription;
|
|
463
|
+
if (event.listedToolNames && event.listedToolNames.length > 0 && event.eventType === MCPAnalyticsEventType.mcpToolsList) properties[PostHogMCPAnalyticsProperty.ListedToolNames] = event.listedToolNames;
|
|
462
464
|
if (event.duration !== void 0) properties[PostHogMCPAnalyticsProperty.DurationMs] = event.duration;
|
|
463
465
|
if (event.serverName) properties[PostHogMCPAnalyticsProperty.ServerName] = event.serverName;
|
|
464
466
|
if (event.serverVersion) properties[PostHogMCPAnalyticsProperty.ServerVersion] = event.serverVersion;
|
|
@@ -557,6 +559,7 @@ const PROTECTED_FIELDS = new Set([
|
|
|
557
559
|
"identifyData",
|
|
558
560
|
"resourceName",
|
|
559
561
|
"toolDescription",
|
|
562
|
+
"listedToolNames",
|
|
560
563
|
"eventType",
|
|
561
564
|
"actorId",
|
|
562
565
|
"tags",
|
|
@@ -734,7 +737,7 @@ function sanitizeParameters(obj) {
|
|
|
734
737
|
}
|
|
735
738
|
//#endregion
|
|
736
739
|
//#region package.json
|
|
737
|
-
var version = "0.0.
|
|
740
|
+
var version = "0.0.7";
|
|
738
741
|
//#endregion
|
|
739
742
|
//#region src/modules/session.ts
|
|
740
743
|
function newSessionId() {
|
|
@@ -1195,6 +1198,7 @@ function publishEvent(server, eventInput) {
|
|
|
1195
1198
|
identifyActorData: sessionInfo.identifyActorData,
|
|
1196
1199
|
resourceName: eventInput.resourceName,
|
|
1197
1200
|
toolDescription: eventInput.toolDescription,
|
|
1201
|
+
listedToolNames: eventInput.listedToolNames,
|
|
1198
1202
|
parameters: eventInput.parameters,
|
|
1199
1203
|
response: eventInput.response,
|
|
1200
1204
|
userIntent: eventInput.userIntent,
|
|
@@ -2129,11 +2133,17 @@ async function handleListToolsRequest(server, originalListToolsHandler, request,
|
|
|
2129
2133
|
return { tools };
|
|
2130
2134
|
}
|
|
2131
2135
|
event.response = { tools };
|
|
2136
|
+
event.listedToolNames = collectListedToolNames(tools);
|
|
2132
2137
|
event.isError = false;
|
|
2133
2138
|
event.duration = getEventDuration(event);
|
|
2134
2139
|
publishEvent(server, event);
|
|
2135
2140
|
return { tools };
|
|
2136
2141
|
}
|
|
2142
|
+
function collectListedToolNames(tools) {
|
|
2143
|
+
if (!tools || tools.length === 0) return;
|
|
2144
|
+
const names = tools.map((tool) => tool?.name).filter((name) => typeof name === "string");
|
|
2145
|
+
return names.length > 0 ? names : void 0;
|
|
2146
|
+
}
|
|
2137
2147
|
async function getTracedToolsList(server, originalListToolsHandler, request, extra, event) {
|
|
2138
2148
|
try {
|
|
2139
2149
|
const data = getServerTrackingData(server);
|