@posthog/mcp 0.0.5 → 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 +12 -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 +12 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -98,6 +98,7 @@ declare const PostHogMCPAnalyticsProperty: {
|
|
|
98
98
|
readonly IsError: "$mcp_is_error";
|
|
99
99
|
readonly Intent: "$mcp_intent";
|
|
100
100
|
readonly IntentSource: "$mcp_intent_source";
|
|
101
|
+
readonly ListedToolNames: "$mcp_listed_tool_names";
|
|
101
102
|
readonly Parameters: "$mcp_parameters";
|
|
102
103
|
readonly ResourceName: "$mcp_resource_name";
|
|
103
104
|
readonly Response: "$mcp_response";
|
package/dist/index.d.mts
CHANGED
|
@@ -97,6 +97,7 @@ declare const PostHogMCPAnalyticsProperty: {
|
|
|
97
97
|
readonly IsError: "$mcp_is_error";
|
|
98
98
|
readonly Intent: "$mcp_intent";
|
|
99
99
|
readonly IntentSource: "$mcp_intent_source";
|
|
100
|
+
readonly ListedToolNames: "$mcp_listed_tool_names";
|
|
100
101
|
readonly Parameters: "$mcp_parameters";
|
|
101
102
|
readonly ResourceName: "$mcp_resource_name";
|
|
102
103
|
readonly Response: "$mcp_response";
|
package/dist/index.mjs
CHANGED
|
@@ -381,6 +381,7 @@ const PostHogMCPAnalyticsProperty = {
|
|
|
381
381
|
IsError: "$mcp_is_error",
|
|
382
382
|
Intent: "$mcp_intent",
|
|
383
383
|
IntentSource: "$mcp_intent_source",
|
|
384
|
+
ListedToolNames: "$mcp_listed_tool_names",
|
|
384
385
|
Parameters: "$mcp_parameters",
|
|
385
386
|
ResourceName: "$mcp_resource_name",
|
|
386
387
|
Response: "$mcp_response",
|
|
@@ -458,6 +459,7 @@ function addCommonEventProperties(event, properties) {
|
|
|
458
459
|
if (event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolName] = event.resourceName;
|
|
459
460
|
}
|
|
460
461
|
if (event.toolDescription && event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolDescription] = event.toolDescription;
|
|
462
|
+
if (event.listedToolNames && event.listedToolNames.length > 0 && event.eventType === MCPAnalyticsEventType.mcpToolsList) properties[PostHogMCPAnalyticsProperty.ListedToolNames] = event.listedToolNames;
|
|
461
463
|
if (event.duration !== void 0) properties[PostHogMCPAnalyticsProperty.DurationMs] = event.duration;
|
|
462
464
|
if (event.serverName) properties[PostHogMCPAnalyticsProperty.ServerName] = event.serverName;
|
|
463
465
|
if (event.serverVersion) properties[PostHogMCPAnalyticsProperty.ServerVersion] = event.serverVersion;
|
|
@@ -499,6 +501,7 @@ function buildExceptionEvent(event) {
|
|
|
499
501
|
if (event.serverVersion) properties[PostHogMCPAnalyticsProperty.ServerVersion] = event.serverVersion;
|
|
500
502
|
if (event.clientName) properties[PostHogMCPAnalyticsProperty.ClientName] = event.clientName;
|
|
501
503
|
if (event.clientVersion) properties[PostHogMCPAnalyticsProperty.ClientVersion] = event.clientVersion;
|
|
504
|
+
addCustomEventProperties(event, properties);
|
|
502
505
|
return {
|
|
503
506
|
event: PostHogMCPAnalyticsEvent.Exception,
|
|
504
507
|
distinct_id: distinctId,
|
|
@@ -555,6 +558,7 @@ const PROTECTED_FIELDS = new Set([
|
|
|
555
558
|
"identifyData",
|
|
556
559
|
"resourceName",
|
|
557
560
|
"toolDescription",
|
|
561
|
+
"listedToolNames",
|
|
558
562
|
"eventType",
|
|
559
563
|
"actorId",
|
|
560
564
|
"tags",
|
|
@@ -732,7 +736,7 @@ function sanitizeParameters(obj) {
|
|
|
732
736
|
}
|
|
733
737
|
//#endregion
|
|
734
738
|
//#region package.json
|
|
735
|
-
var version = "0.0.
|
|
739
|
+
var version = "0.0.7";
|
|
736
740
|
//#endregion
|
|
737
741
|
//#region src/modules/session.ts
|
|
738
742
|
function newSessionId() {
|
|
@@ -1193,6 +1197,7 @@ function publishEvent(server, eventInput) {
|
|
|
1193
1197
|
identifyActorData: sessionInfo.identifyActorData,
|
|
1194
1198
|
resourceName: eventInput.resourceName,
|
|
1195
1199
|
toolDescription: eventInput.toolDescription,
|
|
1200
|
+
listedToolNames: eventInput.listedToolNames,
|
|
1196
1201
|
parameters: eventInput.parameters,
|
|
1197
1202
|
response: eventInput.response,
|
|
1198
1203
|
userIntent: eventInput.userIntent,
|
|
@@ -2127,11 +2132,17 @@ async function handleListToolsRequest(server, originalListToolsHandler, request,
|
|
|
2127
2132
|
return { tools };
|
|
2128
2133
|
}
|
|
2129
2134
|
event.response = { tools };
|
|
2135
|
+
event.listedToolNames = collectListedToolNames(tools);
|
|
2130
2136
|
event.isError = false;
|
|
2131
2137
|
event.duration = getEventDuration(event);
|
|
2132
2138
|
publishEvent(server, event);
|
|
2133
2139
|
return { tools };
|
|
2134
2140
|
}
|
|
2141
|
+
function collectListedToolNames(tools) {
|
|
2142
|
+
if (!tools || tools.length === 0) return;
|
|
2143
|
+
const names = tools.map((tool) => tool?.name).filter((name) => typeof name === "string");
|
|
2144
|
+
return names.length > 0 ? names : void 0;
|
|
2145
|
+
}
|
|
2135
2146
|
async function getTracedToolsList(server, originalListToolsHandler, request, extra, event) {
|
|
2136
2147
|
try {
|
|
2137
2148
|
const data = getServerTrackingData(server);
|