@posthog/mcp 0.16.4 → 0.18.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.
- package/README.md +68 -25
- package/dist/extensions/constants.d.ts +45 -45
- package/dist/extensions/constants.d.ts.map +1 -1
- package/dist/extensions/event-types.d.ts +11 -11
- package/dist/extensions/event-types.d.ts.map +1 -1
- package/dist/extensions/feedback.d.ts +1 -1
- package/dist/extensions/instrumentation.d.ts.map +1 -1
- package/dist/extensions/instrumentation.js +33 -9
- package/dist/extensions/instrumentation.mjs +34 -10
- package/dist/extensions/internal.d.ts.map +1 -1
- package/dist/extensions/model-parameters.d.ts +1 -1
- package/dist/extensions/model-parameters.d.ts.map +1 -1
- package/dist/extensions/model-parameters.js +1 -1
- package/dist/extensions/model-parameters.mjs +1 -1
- package/dist/extensions/posthog-mcp.d.ts +53 -18
- package/dist/extensions/posthog-mcp.d.ts.map +1 -1
- package/dist/extensions/posthog-mcp.js +107 -25
- package/dist/extensions/posthog-mcp.mjs +108 -26
- package/dist/extensions/sink.d.ts.map +1 -1
- package/dist/extensions/tools.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.mjs +3 -2
- package/dist/types.d.ts +34 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +6 -5
- package/src/extensions/instrumentation.ts +55 -22
- package/src/extensions/model-parameters.ts +4 -2
- package/src/extensions/posthog-mcp.ts +185 -47
- package/src/index.ts +7 -2
- package/src/types.ts +35 -5
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ Protocol revision is a property of each **request**, not of the server: a v2 ser
|
|
|
80
80
|
|
|
81
81
|
- **On `2026-07-28`** there is no `initialize` and no session header — the revision removed
|
|
82
82
|
protocol-level sessions, and this SDK will not mint one. Session correlation therefore comes from
|
|
83
|
-
`enableConversationId`, which is **
|
|
83
|
+
`enableConversationId`, which is **on by default**. Without it every request is its own `$session_id`.
|
|
84
84
|
The `get_more_tools` and `send_feedback` virtual tools also use this handle, including calls handled
|
|
85
85
|
by a fresh server instance.
|
|
86
86
|
- **On `2025-11-25`**, the session id and the client's name and version are exchanged once at
|
|
@@ -160,9 +160,31 @@ over-redacting ordinary prose. It also applies only to `$mcp_intent`: structured
|
|
|
160
160
|
results are left as-is, because the same shapes are often legitimate data there. If you need a stronger
|
|
161
161
|
guarantee, `context: false` and the `beforeSend` hook above remain the ways to drop the field entirely.
|
|
162
162
|
|
|
163
|
+
### Defaults and opt-outs
|
|
164
|
+
|
|
165
|
+
On fresh low-level instances, tools with an `outputSchema` deliver new handles through `content` only. Clients that consume only `structuredContent` will not echo those handles, so correlation is not guaranteed for that combination. Unknown ownership can also cause a prompt-back block to be appended for a schema that discovery would not extend; disable `enableConversationId` if that contract is unsuitable.
|
|
166
|
+
|
|
167
|
+
A valid echoed conversation handle takes precedence over transport sessions. A request that already carries a transport session or a PostHog session token does not mint a new handle or append a prompt-back block. Requests carrying neither use the conversation fallback.
|
|
168
|
+
|
|
169
|
+
Intent, model capture, conversation correlation, and exception capture are enabled by default.
|
|
170
|
+
Missing-capability reporting and feedback collection remain disabled.
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
instrument(server, posthog, { captureModel: false, enableConversationId: false })
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Model capture adds a required `llm_model` argument to compatible tool schemas. Dispatch never
|
|
177
|
+
enforces it, so servers keep working; strict-schema clients see the new field. Set
|
|
178
|
+
`captureModel: false` to leave schemas untouched. Conversation correlation adds an optional
|
|
179
|
+
`conversation_id` argument and returns a handle in eligible tool results. Clients must echo that
|
|
180
|
+
handle to group later calls; calls without it mint new handles. Set `enableConversationId: false`
|
|
181
|
+
to retain transport-based session grouping and unchanged response content. Custom `PostHogMCP`
|
|
182
|
+
dispatchers also enable model capture and conversation correlation by default.
|
|
183
|
+
The reasoning behind these defaults is in [ADR-0013](./docs/adr/0013-analytics-capture-is-on-by-default.md).
|
|
184
|
+
|
|
163
185
|
### What `$mcp_llm_model` records, and when it stays empty
|
|
164
186
|
|
|
165
|
-
`captureModel` is **
|
|
187
|
+
`captureModel` is **on** by default. The SDK records the best model id visible to the
|
|
166
188
|
server as `$mcp_llm_model`. Recognized client metadata wins with source `client_metadata`. Otherwise,
|
|
167
189
|
the SDK injects a required `llm_model` parameter and records the answer with source `self_reported`.
|
|
168
190
|
|
|
@@ -173,47 +195,62 @@ Missing, blank, and `unknown` values are recorded as nothing.
|
|
|
173
195
|
The recognized metadata path is Codex's `x-codex-turn-metadata.model` field inside request `_meta`.
|
|
174
196
|
Other clients keep using self-report until they expose a stable model field.
|
|
175
197
|
|
|
176
|
-
|
|
177
|
-
|
|
198
|
+
Like `context`, self-report follows the ownership rule of ADR-0011: reading `llm_model` fails
|
|
199
|
+
open where the SDK cannot tell who declared it, stripping it requires proof that the SDK did:
|
|
178
200
|
|
|
179
201
|
- `instrument(server)` on a high-level `McpServer` resolves ownership for your registered tools per
|
|
180
202
|
request from the live tool registry, so those work even on a fresh instance.
|
|
181
203
|
- The `get_more_tools` virtual tool works on any instance and on either server type: the SDK writes
|
|
182
204
|
that descriptor itself, so what it declares is known without a listing.
|
|
183
|
-
- Instrumenting a low-level `Server` learns ownership
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
205
|
+
- Instrumenting a low-level `Server` learns ownership while serving `tools/list`. A fresh instance
|
|
206
|
+
that never served one — `createMcpHandler`, or `@rekog/mcp-nest` in its stateless mode — has no
|
|
207
|
+
answer, so it records `llm_model` as the self-reported model and strips nothing. A tool that
|
|
208
|
+
declares its own `llm_model` on such an instance is therefore recorded under `$mcp_llm_model`
|
|
209
|
+
until a listing says otherwise; `captureModel: false` or dropping the property in `beforeSend`
|
|
210
|
+
are the escapes. The SDK never replays your listing handler on the call path to find out.
|
|
189
211
|
|
|
190
212
|
As with `context`, what matters is instance lifetime rather than statelessness: a transport-stateless
|
|
191
213
|
server (`sessionIdGenerator: undefined`) that keeps one long-lived server object learns ownership
|
|
192
214
|
from the first `tools/list` and keeps it.
|
|
193
215
|
|
|
194
|
-
For a custom dispatcher,
|
|
195
|
-
injects the
|
|
196
|
-
`
|
|
197
|
-
`
|
|
198
|
-
`tools/list` and `tools/call` reach different
|
|
216
|
+
For a custom dispatcher, `PostHogMCP` enables model capture and conversation correlation by default.
|
|
217
|
+
`prepareToolList()` injects the analytics fields and records ownership by tool name.
|
|
218
|
+
`prepareToolCall()` removes SDK-owned arguments and resolves the conversation and session.
|
|
219
|
+
`prepareToolResult()` returns the result to send and the final values to capture. Pass the original
|
|
220
|
+
tool descriptor on each call so this also works when `tools/list` and `tools/call` reach different
|
|
221
|
+
server replicas:
|
|
199
222
|
|
|
200
223
|
```ts
|
|
201
|
-
const posthog = new PostHogMCP(process.env.POSTHOG_PROJECT_TOKEN
|
|
224
|
+
const posthog = new PostHogMCP(process.env.POSTHOG_PROJECT_TOKEN)
|
|
202
225
|
|
|
203
226
|
const tools = posthog.prepareToolList(serverTools)
|
|
204
227
|
const originalTool = serverTools.find((tool) => tool.name === toolName)
|
|
205
|
-
const
|
|
228
|
+
const preparedCall = posthog.prepareToolCall(toolName, rawArgs, {
|
|
206
229
|
originalTool,
|
|
207
230
|
requestMeta: request.params?._meta,
|
|
231
|
+
sessionId: transportSessionId,
|
|
232
|
+
})
|
|
233
|
+
const toolResult = await dispatch(toolName, preparedCall.args)
|
|
234
|
+
const preparedResult = posthog.prepareToolResult(toolResult, preparedCall)
|
|
235
|
+
|
|
236
|
+
posthog.captureToolCall({
|
|
237
|
+
toolName,
|
|
238
|
+
llmModel: preparedCall.llmModel,
|
|
239
|
+
llmModelSource: preparedCall.llmModelSource,
|
|
240
|
+
sessionId: preparedResult.sessionId,
|
|
241
|
+
conversationId: preparedResult.conversationId,
|
|
242
|
+
isError: false,
|
|
208
243
|
})
|
|
209
|
-
const result = await dispatch(toolName, args)
|
|
210
244
|
|
|
211
|
-
|
|
245
|
+
return preparedResult.result
|
|
212
246
|
```
|
|
213
247
|
|
|
214
248
|
A persistent single-process dispatcher can omit `originalTool` after it has prepared its tool list.
|
|
215
249
|
Pass `requestMeta` whenever the request supplies `_meta`; this enables recognized client metadata
|
|
216
|
-
without changing the arguments sent to the tool.
|
|
250
|
+
without changing the arguments sent to the tool. Pass an existing transport or request session as
|
|
251
|
+
`sessionId`. A valid echoed conversation handle takes precedence. Otherwise, the existing session
|
|
252
|
+
prevents a new handle from being minted. Set `enableConversationId: false` on `PostHogMCP` to keep
|
|
253
|
+
the previous custom-dispatcher behavior.
|
|
217
254
|
|
|
218
255
|
### Collecting agent feedback (`send_feedback`)
|
|
219
256
|
|
|
@@ -266,11 +303,17 @@ return { tools: posthog.prepareToolList(myTools, { collectFeedback: true }) }
|
|
|
266
303
|
|
|
267
304
|
// tools/call dispatcher
|
|
268
305
|
const originalTool = myTools.find((tool) => tool.name === name)
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
306
|
+
const preparedCall = posthog.prepareToolCall(name, rawArgs, { originalTool })
|
|
307
|
+
if (preparedCall.isFeedback) {
|
|
308
|
+
await myFeedbackBackend.record(preparedCall.feedbackReport!)
|
|
309
|
+
const preparedResult = posthog.prepareToolResult(sendFeedbackResult(), preparedCall)
|
|
310
|
+
posthog.captureFeedback({
|
|
311
|
+
report: preparedCall.feedbackReport!,
|
|
312
|
+
sessionId: preparedResult.sessionId,
|
|
313
|
+
conversationId: preparedResult.conversationId,
|
|
314
|
+
...identity,
|
|
315
|
+
})
|
|
316
|
+
return preparedResult.result
|
|
274
317
|
}
|
|
275
318
|
```
|
|
276
319
|
|
|
@@ -5,54 +5,54 @@ export declare const DEFAULT_CONVERSATION_ID_DESCRIPTION = "Echo the conversatio
|
|
|
5
5
|
export declare const POSTHOG_MCP_ANALYTICS_SOURCE = "posthog_mcp_analytics";
|
|
6
6
|
export declare const POSTHOG_MCP_LIB_NAME = "posthog-node-mcp";
|
|
7
7
|
export declare const PostHogMCPAnalyticsEvent: {
|
|
8
|
-
readonly Custom:
|
|
9
|
-
readonly Exception:
|
|
10
|
-
readonly Feedback:
|
|
11
|
-
readonly Identify:
|
|
12
|
-
readonly Initialize:
|
|
13
|
-
readonly MissingCapability:
|
|
14
|
-
readonly PromptGet:
|
|
15
|
-
readonly PromptsList:
|
|
16
|
-
readonly ResourceRead:
|
|
17
|
-
readonly ResourcesList:
|
|
18
|
-
readonly ToolCall:
|
|
19
|
-
readonly ToolsList:
|
|
8
|
+
readonly Custom: '$mcp_custom';
|
|
9
|
+
readonly Exception: '$exception';
|
|
10
|
+
readonly Feedback: '$mcp_feedback';
|
|
11
|
+
readonly Identify: '$identify';
|
|
12
|
+
readonly Initialize: '$mcp_initialize';
|
|
13
|
+
readonly MissingCapability: '$mcp_missing_capability';
|
|
14
|
+
readonly PromptGet: '$mcp_prompt_get';
|
|
15
|
+
readonly PromptsList: '$mcp_prompts_list';
|
|
16
|
+
readonly ResourceRead: '$mcp_resource_read';
|
|
17
|
+
readonly ResourcesList: '$mcp_resources_list';
|
|
18
|
+
readonly ToolCall: '$mcp_tool_call';
|
|
19
|
+
readonly ToolsList: '$mcp_tools_list';
|
|
20
20
|
};
|
|
21
21
|
export type PostHogMCPAnalyticsEvent = (typeof PostHogMCPAnalyticsEvent)[keyof typeof PostHogMCPAnalyticsEvent];
|
|
22
22
|
export declare const PostHogMCPAnalyticsProperty: {
|
|
23
|
-
readonly ClientName:
|
|
24
|
-
readonly ClientUserAgent:
|
|
25
|
-
readonly ClientVersion:
|
|
26
|
-
readonly ConversationId:
|
|
27
|
-
readonly DurationMs:
|
|
28
|
-
readonly ErrorMessage:
|
|
29
|
-
readonly ErrorType:
|
|
30
|
-
readonly FeedbackDetails:
|
|
31
|
-
readonly FeedbackFrictionPoints:
|
|
32
|
-
readonly FeedbackSentiment:
|
|
33
|
-
readonly FeedbackSuggestedImprovement:
|
|
34
|
-
readonly FeedbackSummary:
|
|
35
|
-
readonly FeedbackTaskCompleted:
|
|
36
|
-
readonly FeedbackTool:
|
|
37
|
-
readonly FeedbackType:
|
|
38
|
-
readonly IsError:
|
|
39
|
-
readonly Intent:
|
|
40
|
-
readonly IntentSource:
|
|
41
|
-
readonly ListedToolNames:
|
|
42
|
-
readonly LlmModel:
|
|
43
|
-
readonly LlmModelSource:
|
|
44
|
-
readonly Parameters:
|
|
45
|
-
readonly ProtocolVersion:
|
|
46
|
-
readonly ResourceName:
|
|
47
|
-
readonly Response:
|
|
48
|
-
readonly ServerName:
|
|
49
|
-
readonly ServerVersion:
|
|
50
|
-
readonly SessionId:
|
|
51
|
-
readonly Source:
|
|
52
|
-
readonly ToolCategory:
|
|
53
|
-
readonly ToolDescription:
|
|
54
|
-
readonly ToolName:
|
|
55
|
-
readonly VendorClient:
|
|
23
|
+
readonly ClientName: '$mcp_client_name';
|
|
24
|
+
readonly ClientUserAgent: '$mcp_client_user_agent';
|
|
25
|
+
readonly ClientVersion: '$mcp_client_version';
|
|
26
|
+
readonly ConversationId: '$mcp_conversation_id';
|
|
27
|
+
readonly DurationMs: '$mcp_duration_ms';
|
|
28
|
+
readonly ErrorMessage: '$mcp_error_message';
|
|
29
|
+
readonly ErrorType: '$mcp_error_type';
|
|
30
|
+
readonly FeedbackDetails: '$mcp_feedback_details';
|
|
31
|
+
readonly FeedbackFrictionPoints: '$mcp_feedback_friction_points';
|
|
32
|
+
readonly FeedbackSentiment: '$mcp_feedback_sentiment';
|
|
33
|
+
readonly FeedbackSuggestedImprovement: '$mcp_feedback_suggested_improvement';
|
|
34
|
+
readonly FeedbackSummary: '$mcp_feedback_summary';
|
|
35
|
+
readonly FeedbackTaskCompleted: '$mcp_feedback_task_completed';
|
|
36
|
+
readonly FeedbackTool: '$mcp_feedback_tool';
|
|
37
|
+
readonly FeedbackType: '$mcp_feedback_type';
|
|
38
|
+
readonly IsError: '$mcp_is_error';
|
|
39
|
+
readonly Intent: '$mcp_intent';
|
|
40
|
+
readonly IntentSource: '$mcp_intent_source';
|
|
41
|
+
readonly ListedToolNames: '$mcp_listed_tool_names';
|
|
42
|
+
readonly LlmModel: '$mcp_llm_model';
|
|
43
|
+
readonly LlmModelSource: '$mcp_llm_model_source';
|
|
44
|
+
readonly Parameters: '$mcp_parameters';
|
|
45
|
+
readonly ProtocolVersion: '$mcp_protocol_version';
|
|
46
|
+
readonly ResourceName: '$mcp_resource_name';
|
|
47
|
+
readonly Response: '$mcp_response';
|
|
48
|
+
readonly ServerName: '$mcp_server_name';
|
|
49
|
+
readonly ServerVersion: '$mcp_server_version';
|
|
50
|
+
readonly SessionId: '$session_id';
|
|
51
|
+
readonly Source: '$mcp_source';
|
|
52
|
+
readonly ToolCategory: '$mcp_tool_category';
|
|
53
|
+
readonly ToolDescription: '$mcp_tool_description';
|
|
54
|
+
readonly ToolName: '$mcp_tool_name';
|
|
55
|
+
readonly VendorClient: '$mcp_vendor_client';
|
|
56
56
|
};
|
|
57
57
|
export type PostHogMCPAnalyticsProperty = (typeof PostHogMCPAnalyticsProperty)[keyof typeof PostHogMCPAnalyticsProperty];
|
|
58
58
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/extensions/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B,KAAK,CAAA;AAE/C,eAAO,MAAM,qCAAqC,onBAA4mB,CAAA;AAE9pB,eAAO,MAAM,mCAAmC,gRAAqQ,CAAA;AAErT,eAAO,MAAM,mCAAmC,4LACsI,CAAA;AAEtL,eAAO,MAAM,4BAA4B,0BAA0B,CAAA;AAMnE,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AAItD,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/extensions/constants.ts"],"names":[],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eAAe,EAAE,wBAAwB;aACzC,QAAQ,EAAE,gBAAgB;aAC1B,cAAc,EAAE,uBAAuB;aACvC,UAAU,EAAE,iBAAiB;aAC7B,eAAe,EAAE,uBAAuB;aACxC,YAAY,EAAE,oBAAoB;aAClC,QAAQ,EAAE,eAAe;aACzB,UAAU,EAAE,kBAAkB;aAC9B,aAAa,EAAE,qBAAqB;aACpC,SAAS,EAAE,aAAa;aACxB,MAAM,EAAE,aAAa;aACrB,YAAY,EAAE,oBAAoB;aAClC,eAAe,EAAE,uBAAuB;aACxC,QAAQ,EAAE,gBAAgB;aAC1B,YAAY,EAAE,oBAAoB;CAC1B,CAAA;AAEV,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,OAAO,2BAA2B,CAAC,CAAA"}
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
* event names.
|
|
7
7
|
*/
|
|
8
8
|
export declare const MCPAnalyticsEventType: {
|
|
9
|
-
readonly identify:
|
|
10
|
-
readonly custom:
|
|
11
|
-
readonly mcpFeedback:
|
|
12
|
-
readonly mcpMissingCapability:
|
|
13
|
-
readonly mcpInitialize:
|
|
14
|
-
readonly mcpPromptsGet:
|
|
15
|
-
readonly mcpPromptsList:
|
|
16
|
-
readonly mcpResourcesList:
|
|
17
|
-
readonly mcpResourcesRead:
|
|
18
|
-
readonly mcpToolsCall:
|
|
19
|
-
readonly mcpToolsList:
|
|
9
|
+
readonly identify: 'posthog:identify';
|
|
10
|
+
readonly custom: 'posthog:custom';
|
|
11
|
+
readonly mcpFeedback: 'mcp:feedback';
|
|
12
|
+
readonly mcpMissingCapability: 'mcp:missing_capability';
|
|
13
|
+
readonly mcpInitialize: 'mcp:initialize';
|
|
14
|
+
readonly mcpPromptsGet: 'mcp:prompts/get';
|
|
15
|
+
readonly mcpPromptsList: 'mcp:prompts/list';
|
|
16
|
+
readonly mcpResourcesList: 'mcp:resources/list';
|
|
17
|
+
readonly mcpResourcesRead: 'mcp:resources/read';
|
|
18
|
+
readonly mcpToolsCall: 'mcp:tools/call';
|
|
19
|
+
readonly mcpToolsList: 'mcp:tools/list';
|
|
20
20
|
};
|
|
21
21
|
export type MCPAnalyticsEventType = (typeof MCPAnalyticsEventType)[keyof typeof MCPAnalyticsEventType];
|
|
22
22
|
//# sourceMappingURL=event-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-types.d.ts","sourceRoot":"","sources":["../../src/extensions/event-types.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"event-types.d.ts","sourceRoot":"","sources":["../../src/extensions/event-types.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;aAChC,QAAQ,EAAE,kBAAkB;aAC5B,MAAM,EAAE,gBAAgB;aACxB,WAAW,EAAE,cAAc;aAC3B,oBAAoB,EAAE,wBAAwB;aAC9C,aAAa,EAAE,gBAAgB;aAC/B,aAAa,EAAE,iBAAiB;aAChC,cAAc,EAAE,kBAAkB;aAClC,gBAAgB,EAAE,oBAAoB;aACtC,gBAAgB,EAAE,oBAAoB;aACtC,YAAY,EAAE,gBAAgB;aAC9B,YAAY,EAAE,gBAAgB;CACtB,CAAA;AAEV,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollectFeedbackOptions, FeedbackReport, CollectFeedbackConfig, CompatibleTextToolResult, CompatibleToolsListLike, JsonRecord } from '../types';
|
|
2
2
|
import { type LoggerFn } from './logger';
|
|
3
|
-
export declare const SEND_FEEDBACK_TOOL_NAME:
|
|
3
|
+
export declare const SEND_FEEDBACK_TOOL_NAME: 'send_feedback';
|
|
4
4
|
type FeedbackToolDescriptor = CompatibleToolsListLike['tools'][number];
|
|
5
5
|
/** `collectFeedback` normalized to its object form; `undefined` when the feature is off. */
|
|
6
6
|
export declare function resolveCollectFeedbackOptions(config: CollectFeedbackConfig | undefined): CollectFeedbackOptions | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../src/extensions/instrumentation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,EACvB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EAId,MAAM,UAAU,CAAA;AAqBjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAIrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAUxC;;;;;;GAMG;AAEH,KAAK,iBAAiB,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,6BAA6B,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAE7G,2EAA2E;AAC3E,KAAK,YAAY,GAAG,CAAC,iBAAiB,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAE3E,UAAU,mBAAmB;IAC3B,MAAM,EAAE,aAAa,CAAA;IACrB,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,KAAK,CAAC,EAAE,6BAA6B,CAAA;IACrC,OAAO,EAAE,YAAY,CAAA;IACrB,2FAA2F;IAC3F,kBAAkB,CAAC,EAAE,2BAA2B,CAAA;IAChD;;;;;OAKG;IACH,SAAS,CAAC,EAAE,qBAAqB,CAAA;IACjC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,UAAU,CAAA;IACjC;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAA;CAClC;AAED;;;;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,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,KAAK,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,SAAS,GAClD,IAAI,CASN;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGtE;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,KAAK,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,SAAS,GAClD,IAAI,CAUN;AAuHD;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,aAAa,EACrB,yBAAyB,EAAE,iBAAiB,EAC5C,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,6BAA6B,GAAG,SAAS,EAChD,MAAM,EAAE,QAAQ,GACf,OAAO,CAAC,OAAO,CAAC,CA2ElB"}
|
|
@@ -64,9 +64,9 @@ async function captureToolCall(params) {
|
|
|
64
64
|
const resolvedEventType = eventType ?? external_event_types_js_namespaceObject.MCPAnalyticsEventType.mcpToolsCall;
|
|
65
65
|
const isVirtualAnalyticsTool = resolvedEventType === external_event_types_js_namespaceObject.MCPAnalyticsEventType.mcpMissingCapability || resolvedEventType === external_event_types_js_namespaceObject.MCPAnalyticsEventType.mcpFeedback;
|
|
66
66
|
const ownership = getActiveAnalyticsParameterOwnership(data, request.params?.name, parameterOwnership, isVirtualAnalyticsTool);
|
|
67
|
-
const canCaptureContextIntent =
|
|
68
|
-
const conversation = (
|
|
69
|
-
const downstreamRequest = cloneRequestWithoutOwnedAnalyticsArguments(request, ownership);
|
|
67
|
+
const canCaptureContextIntent = ownership.read.context;
|
|
68
|
+
const conversation = resolveToolConversation(ownership.read.conversationId, request.params?.arguments, extra);
|
|
69
|
+
const downstreamRequest = cloneRequestWithoutOwnedAnalyticsArguments(request, ownership.strip);
|
|
70
70
|
const startTime = new Date();
|
|
71
71
|
const preparedEvent = await prepareToolCallEvent(server, data, request, downstreamRequest, extra, startTime, conversation, ownership, resolvedEventType, canCaptureContextIntent);
|
|
72
72
|
if (preparedEvent && explicitContextIntent) (0, external_intent_js_namespaceObject.setExplicitContextIntent)(preparedEvent.event, explicitContextIntent);
|
|
@@ -86,15 +86,39 @@ async function captureToolCall(params) {
|
|
|
86
86
|
publishSuccessfulToolEvent(server, preparedEvent, finalResult, startTime, data.logger, takeCapturedError, result);
|
|
87
87
|
return finalResult;
|
|
88
88
|
}
|
|
89
|
+
function resolveToolConversation(enabled, args, extra) {
|
|
90
|
+
const conversation = (0, external_conversation_id_js_namespaceObject.resolveConversationId)(enabled, args);
|
|
91
|
+
if (!conversation.minted) return conversation;
|
|
92
|
+
const carriedSession = extra?.sessionId || (0, external_session_token_js_namespaceObject.decodeSessionId)((0, external_session_token_js_namespaceObject.readMcpSessionHeader)((0, external_request_headers_js_namespaceObject.getRequestHeaders)(extra)));
|
|
93
|
+
return carriedSession ? {
|
|
94
|
+
minted: false,
|
|
95
|
+
conversationId: void 0
|
|
96
|
+
} : conversation;
|
|
97
|
+
}
|
|
89
98
|
function getActiveAnalyticsParameterOwnership(data, toolName, override, isVirtualAnalyticsTool) {
|
|
90
99
|
const listed = toolName ? data.toolAnalyticsParameterOwnership.get(toolName) : void 0;
|
|
91
100
|
const ownership = override ?? listed;
|
|
101
|
+
const enabled = {
|
|
102
|
+
context: !isVirtualAnalyticsTool && (0, external_context_parameters_js_namespaceObject.isContextEnabled)(data.options.context),
|
|
103
|
+
conversationId: true === data.options.enableConversationId,
|
|
104
|
+
llmModel: (0, external_model_parameters_js_namespaceObject.isCaptureModelEnabled)(data.options.captureModel)
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
strip: enabledArgumentOwnership(enabled, ownership, false),
|
|
108
|
+
read: enabledArgumentOwnership(enabled, ownership, true),
|
|
109
|
+
outputInstructions: enabled.conversationId && listed?.outputInstructions === true
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function enabledArgumentOwnership(enabled, ownership, whenUnknown) {
|
|
113
|
+
const resolved = ownership ?? {
|
|
114
|
+
context: whenUnknown,
|
|
115
|
+
conversationId: whenUnknown,
|
|
116
|
+
llmModel: whenUnknown
|
|
117
|
+
};
|
|
92
118
|
return {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
llmModel: (0, external_model_parameters_js_namespaceObject.isCaptureModelEnabled)(data.options.captureModel) && ownership?.llmModel === true,
|
|
97
|
-
outputInstructions: true === data.options.enableConversationId && listed?.outputInstructions === true
|
|
119
|
+
context: enabled.context && resolved.context,
|
|
120
|
+
conversationId: enabled.conversationId && resolved.conversationId,
|
|
121
|
+
llmModel: enabled.llmModel && resolved.llmModel
|
|
98
122
|
};
|
|
99
123
|
}
|
|
100
124
|
function cloneRequestWithoutOwnedAnalyticsArguments(request, ownership) {
|
|
@@ -131,7 +155,7 @@ async function prepareToolCallEvent(server, data, request, downstreamRequest, ex
|
|
|
131
155
|
await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);
|
|
132
156
|
(0, external_intent_js_namespaceObject.setEventIntent)(event, await (0, external_intent_js_namespaceObject.resolveToolCallIntent)(data, request, canCaptureContextIntent, extra));
|
|
133
157
|
if ((0, external_model_parameters_js_namespaceObject.isCaptureModelEnabled)(data.options.captureModel)) {
|
|
134
|
-
const resolvedModel = (0, external_model_parameters_js_namespaceObject.resolveModel)(request, ownership.llmModel);
|
|
158
|
+
const resolvedModel = (0, external_model_parameters_js_namespaceObject.resolveModel)(request, ownership.read.llmModel);
|
|
135
159
|
(0, external_model_parameters_js_namespaceObject.setEventModel)(event, resolvedModel?.model, resolvedModel?.source);
|
|
136
160
|
}
|
|
137
161
|
return {
|
|
@@ -14,7 +14,7 @@ import { buildCapturedMcpParameters } from "./mcp-payloads.mjs";
|
|
|
14
14
|
import { readRequestHandlerMethod } from "./mcp-sdk-compat.mjs";
|
|
15
15
|
import { getRequestHeaders } from "./request-headers.mjs";
|
|
16
16
|
import { getSessionId, getSessionInfo, isModernEraRequest, newSessionId } from "./session.mjs";
|
|
17
|
-
import { encodeSessionId, readMcpSessionHeader, writeSessionIdToTransport } from "./session-token.mjs";
|
|
17
|
+
import { decodeSessionId, encodeSessionId, readMcpSessionHeader, writeSessionIdToTransport } from "./session-token.mjs";
|
|
18
18
|
import { SEND_FEEDBACK_TOOL_NAME, getFeedbackToolDescriptor, resolveCollectFeedbackOptions } from "./feedback.mjs";
|
|
19
19
|
import { getReportMissingToolDescriptor, resolveMissingCapabilityToolName } from "./tools.mjs";
|
|
20
20
|
import { applyResolvedMetadata, isToolResultError } from "./tracing-helpers.mjs";
|
|
@@ -23,9 +23,9 @@ async function captureToolCall(params) {
|
|
|
23
23
|
const resolvedEventType = eventType ?? MCPAnalyticsEventType.mcpToolsCall;
|
|
24
24
|
const isVirtualAnalyticsTool = resolvedEventType === MCPAnalyticsEventType.mcpMissingCapability || resolvedEventType === MCPAnalyticsEventType.mcpFeedback;
|
|
25
25
|
const ownership = getActiveAnalyticsParameterOwnership(data, request.params?.name, parameterOwnership, isVirtualAnalyticsTool);
|
|
26
|
-
const canCaptureContextIntent =
|
|
27
|
-
const conversation =
|
|
28
|
-
const downstreamRequest = cloneRequestWithoutOwnedAnalyticsArguments(request, ownership);
|
|
26
|
+
const canCaptureContextIntent = ownership.read.context;
|
|
27
|
+
const conversation = resolveToolConversation(ownership.read.conversationId, request.params?.arguments, extra);
|
|
28
|
+
const downstreamRequest = cloneRequestWithoutOwnedAnalyticsArguments(request, ownership.strip);
|
|
29
29
|
const startTime = new Date();
|
|
30
30
|
const preparedEvent = await prepareToolCallEvent(server, data, request, downstreamRequest, extra, startTime, conversation, ownership, resolvedEventType, canCaptureContextIntent);
|
|
31
31
|
if (preparedEvent && explicitContextIntent) setExplicitContextIntent(preparedEvent.event, explicitContextIntent);
|
|
@@ -45,15 +45,39 @@ async function captureToolCall(params) {
|
|
|
45
45
|
publishSuccessfulToolEvent(server, preparedEvent, finalResult, startTime, data.logger, takeCapturedError, result);
|
|
46
46
|
return finalResult;
|
|
47
47
|
}
|
|
48
|
+
function resolveToolConversation(enabled, args, extra) {
|
|
49
|
+
const conversation = resolveConversationId(enabled, args);
|
|
50
|
+
if (!conversation.minted) return conversation;
|
|
51
|
+
const carriedSession = extra?.sessionId || decodeSessionId(readMcpSessionHeader(getRequestHeaders(extra)));
|
|
52
|
+
return carriedSession ? {
|
|
53
|
+
minted: false,
|
|
54
|
+
conversationId: void 0
|
|
55
|
+
} : conversation;
|
|
56
|
+
}
|
|
48
57
|
function getActiveAnalyticsParameterOwnership(data, toolName, override, isVirtualAnalyticsTool) {
|
|
49
58
|
const listed = toolName ? data.toolAnalyticsParameterOwnership.get(toolName) : void 0;
|
|
50
59
|
const ownership = override ?? listed;
|
|
60
|
+
const enabled = {
|
|
61
|
+
context: !isVirtualAnalyticsTool && isContextEnabled(data.options.context),
|
|
62
|
+
conversationId: true === data.options.enableConversationId,
|
|
63
|
+
llmModel: isCaptureModelEnabled(data.options.captureModel)
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
strip: enabledArgumentOwnership(enabled, ownership, false),
|
|
67
|
+
read: enabledArgumentOwnership(enabled, ownership, true),
|
|
68
|
+
outputInstructions: enabled.conversationId && listed?.outputInstructions === true
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function enabledArgumentOwnership(enabled, ownership, whenUnknown) {
|
|
72
|
+
const resolved = ownership ?? {
|
|
73
|
+
context: whenUnknown,
|
|
74
|
+
conversationId: whenUnknown,
|
|
75
|
+
llmModel: whenUnknown
|
|
76
|
+
};
|
|
51
77
|
return {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
llmModel: isCaptureModelEnabled(data.options.captureModel) && ownership?.llmModel === true,
|
|
56
|
-
outputInstructions: true === data.options.enableConversationId && listed?.outputInstructions === true
|
|
78
|
+
context: enabled.context && resolved.context,
|
|
79
|
+
conversationId: enabled.conversationId && resolved.conversationId,
|
|
80
|
+
llmModel: enabled.llmModel && resolved.llmModel
|
|
57
81
|
};
|
|
58
82
|
}
|
|
59
83
|
function cloneRequestWithoutOwnedAnalyticsArguments(request, ownership) {
|
|
@@ -90,7 +114,7 @@ async function prepareToolCallEvent(server, data, request, downstreamRequest, ex
|
|
|
90
114
|
await applyResolvedMetadata(event, data, request, extra);
|
|
91
115
|
setEventIntent(event, await resolveToolCallIntent(data, request, canCaptureContextIntent, extra));
|
|
92
116
|
if (isCaptureModelEnabled(data.options.captureModel)) {
|
|
93
|
-
const resolvedModel = resolveModel(request, ownership.llmModel);
|
|
117
|
+
const resolvedModel = resolveModel(request, ownership.read.llmModel);
|
|
94
118
|
setEventModel(event, resolvedModel?.model, resolvedModel?.source);
|
|
95
119
|
}
|
|
96
120
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/extensions/internal.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,cAAc,EACd,aAAa,EAEb,WAAW,EACX,YAAY,EACb,MAAM,UAAU,CAAA;AAMjB;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IACzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/extensions/internal.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,cAAc,EACd,aAAa,EAEb,WAAW,EACX,YAAY,EACb,MAAM,UAAU,CAAA;AAMjB;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IACzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IAEjC,YAAY,OAAO,SAAO,EAEzB;IAED,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,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
|
|
27
|
-
/**
|
|
27
|
+
/** Model capture is enabled unless explicitly disabled. */
|
|
28
28
|
export declare function isCaptureModelEnabled(captureModel: MCPAnalyticsOptions['captureModel']): boolean;
|
|
29
29
|
export declare function getModelDescription(captureModel: MCPAnalyticsOptions['captureModel']): string | undefined;
|
|
30
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-parameters.d.ts","sourceRoot":"","sources":["../../src/extensions/model-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACtG,OAAO,EAA+B,KAAK,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AAExG,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE7C;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,6BAA6B,CAAA;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,
|
|
1
|
+
{"version":3,"file":"model-parameters.d.ts","sourceRoot":"","sources":["../../src/extensions/model-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACtG,OAAO,EAA+B,KAAK,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AAExG,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE7C;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,6BAA6B,CAAA;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,2DAA2D;AAC3D,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,mBAAmB,CAAC,cAAc,CAAC,GAAG,OAAO,CAIhG;AAED,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,mBAAmB,CAAC,cAAc,CAAC,GAAG,MAAM,GAAG,SAAS,CAEzG;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,SAAS,mBAAmB,EACvE,IAAI,EAAE,KAAK,EACX,wBAAwB,CAAC,EAAE,MAAM,EACjC,MAAM,GAAE,QAAc,GACrB,KAAK,CAQP;AAED,wBAAgB,wBAAwB,CAAC,KAAK,SAAS,mBAAmB,EACxE,KAAK,EAAE,KAAK,EAAE,EACd,wBAAwB,CAAC,EAAE,MAAM,EACjC,MAAM,GAAE,QAAc,GACrB,KAAK,EAAE,CAET;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAE5E;AAID,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,uBAAuB,CAAA;CAChC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAiB3G;AAiBD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,QAAQ,EACf,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,GAAE,uBAAyC,GAChD,IAAI,CAON"}
|
|
@@ -40,7 +40,7 @@ const external_analytics_parameters_js_namespaceObject = require("./analytics-pa
|
|
|
40
40
|
const external_constants_js_namespaceObject = require("./constants.js");
|
|
41
41
|
const external_logger_js_namespaceObject = require("./logger.js");
|
|
42
42
|
function isCaptureModelEnabled(captureModel) {
|
|
43
|
-
return true === captureModel || 'object' == typeof captureModel && null !== captureModel;
|
|
43
|
+
return void 0 === captureModel || true === captureModel || 'object' == typeof captureModel && null !== captureModel;
|
|
44
44
|
}
|
|
45
45
|
function getModelDescription(captureModel) {
|
|
46
46
|
return 'object' == typeof captureModel && null !== captureModel ? captureModel.description : void 0;
|
|
@@ -2,7 +2,7 @@ import { addAnalyticsParameterToTool } from "./analytics-parameters.mjs";
|
|
|
2
2
|
import { DEFAULT_MODEL_PARAMETER_DESCRIPTION } from "./constants.mjs";
|
|
3
3
|
import { log } from "./logger.mjs";
|
|
4
4
|
function isCaptureModelEnabled(captureModel) {
|
|
5
|
-
return true === captureModel || 'object' == typeof captureModel && null !== captureModel;
|
|
5
|
+
return void 0 === captureModel || true === captureModel || 'object' == typeof captureModel && null !== captureModel;
|
|
6
6
|
}
|
|
7
7
|
function getModelDescription(captureModel) {
|
|
8
8
|
return 'object' == typeof captureModel && null !== captureModel ? captureModel.description : void 0;
|