@posthog/mcp 0.16.2 → 0.16.3
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 +5 -4
- package/dist/extensions/instrumentation.d.ts.map +1 -1
- package/dist/extensions/instrumentation.js +4 -4
- package/dist/extensions/instrumentation.mjs +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +1 -1
- package/src/extensions/instrumentation.ts +16 -8
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -283,10 +283,11 @@ both advertises both tools. Like `get_more_tools`, a real tool that already uses
|
|
|
283
283
|
wins: the SDK warns, skips injection, and delegates calls to the real handler.
|
|
284
284
|
|
|
285
285
|
On a paginated catalogue (a `tools/list` response with a `nextCursor`), `instrument()` injects
|
|
286
|
-
`send_feedback` on the first page only — the page every
|
|
287
|
-
follow `nextCursor` — so a compliant client's
|
|
288
|
-
a `tools/list` request with no cursor; an
|
|
289
|
-
|
|
286
|
+
its virtual tools (`send_feedback` and `get_more_tools`) on the first page only — the page every
|
|
287
|
+
client reads, including clients that never follow `nextCursor` — so a compliant client's
|
|
288
|
+
concatenated list carries each once. "First page" means a `tools/list` request with no cursor; an
|
|
289
|
+
empty string is a valid cursor, so `cursor: ""` is a continuation page. Hosts using
|
|
290
|
+
`prepareToolList()` directly own this rule themselves: pass `reportMissing: true` and
|
|
290
291
|
`collectFeedback: true` only for the first page.
|
|
291
292
|
|
|
292
293
|
Name collisions are detected on the first page only. A real tool named `send_feedback` (or
|
|
@@ -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,E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AAa,EACrB,eAAe,EAAE,iBAAiB,EAClC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,6BAA6B,GAAG,SAAS,KAC7C,OAAO,CAAC,OAAO,CAAC,CAAA;AAkBrB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,iBAAiB,EAClC,KAAK,EAAE,YAAY,GAClB,IAAI,CAGN;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,IAAI,CA0CvG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,gBAAgB,EACtB,QAAQ,EAAE,MAAM,EAChB,sBAAsB,EAAE,OAAO,GAC9B,2BAA2B,CAK7B;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,6BAA6B,GAAG,SAAS,EAChD,MAAM,EAAE,QAAQ,GACf,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAoB9B;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,aAAa,EACrB,wBAAwB,EAAE,iBAAiB,EAC3C,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,6BAA6B,GAAG,SAAS,EAChD,MAAM,EAAE,QAAQ,GACf,OAAO,CAAC,uBAAuB,CAAC,CAmElC;
|
|
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,UA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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"}
|
|
@@ -372,23 +372,23 @@ async function getTracedToolsList(server, originalListToolsHandler, request, ext
|
|
|
372
372
|
if (data) cacheToolAnalyticsParameterOwnership(data.toolAnalyticsParameterOwnership, tools);
|
|
373
373
|
if (data && (0, external_context_parameters_js_namespaceObject.isContextEnabled)(data.options.context)) tools = (0, external_context_parameters_js_namespaceObject.addContextParameterToTools)(tools, (0, external_context_parameters_js_namespaceObject.getContextDescription)(data.options.context), data.logger);
|
|
374
374
|
if (data) {
|
|
375
|
+
const isFirstPage = request.params?.cursor == null;
|
|
375
376
|
const missingToolName = (0, external_tools_js_namespaceObject.resolveMissingCapabilityToolName)(data.options);
|
|
376
377
|
if (data.options.reportMissing) {
|
|
377
378
|
const alreadyPresent = tools.some((tool)=>tool?.name === missingToolName);
|
|
378
|
-
if (alreadyPresent) data.logger(`Warning: Cannot inject missing-capability tool "${missingToolName}" because a real tool already uses that name. The real tool will not be intercepted.`);
|
|
379
|
-
else {
|
|
379
|
+
if (isFirstPage && alreadyPresent) data.logger(`Warning: Cannot inject missing-capability tool "${missingToolName}" because a real tool already uses that name. The real tool will not be intercepted. To keep missing-capability reports, rename the SDK's tool with the missingCapabilityToolName option.`);
|
|
380
|
+
else if (isFirstPage) {
|
|
380
381
|
const virtualTool = (0, external_tools_js_namespaceObject.getReportMissingToolDescriptor)(missingToolName);
|
|
381
382
|
tools.push(virtualTool);
|
|
382
383
|
cacheToolAnalyticsParameterOwnership(data.toolAnalyticsParameterOwnership, [
|
|
383
384
|
virtualTool
|
|
384
385
|
]);
|
|
385
|
-
}
|
|
386
|
+
} else if (alreadyPresent) data.logger(`Warning: A real tool "${missingToolName}" on a later tools/list page is shadowed by the SDK's missing-capability tool. Its calls will be intercepted. Rename the SDK's tool with the missingCapabilityToolName option to keep both.`);
|
|
386
387
|
}
|
|
387
388
|
const feedbackOptions = (0, external_feedback_js_namespaceObject.resolveCollectFeedbackOptions)(data.options.collectFeedback);
|
|
388
389
|
if (feedbackOptions) {
|
|
389
390
|
const feedbackToolName = feedbackOptions.toolName ?? external_feedback_js_namespaceObject.SEND_FEEDBACK_TOOL_NAME;
|
|
390
391
|
const alreadyPresent = tools.some((tool)=>tool?.name === feedbackToolName);
|
|
391
|
-
const isFirstPage = request.params?.cursor == null;
|
|
392
392
|
if (isFirstPage && alreadyPresent) data.logger(`Warning: Cannot inject agent-feedback tool "${feedbackToolName}" because a real tool already uses that name. The real tool will not be intercepted. To collect feedback alongside it, rename the SDK's tool with collectFeedback: { toolName: "..." }.`);
|
|
393
393
|
else if (isFirstPage) {
|
|
394
394
|
const virtualTool = (0, external_feedback_js_namespaceObject.getFeedbackToolDescriptor)(feedbackOptions);
|
|
@@ -330,23 +330,23 @@ async function getTracedToolsList(server, originalListToolsHandler, request, ext
|
|
|
330
330
|
if (data) cacheToolAnalyticsParameterOwnership(data.toolAnalyticsParameterOwnership, tools);
|
|
331
331
|
if (data && isContextEnabled(data.options.context)) tools = addContextParameterToTools(tools, getContextDescription(data.options.context), data.logger);
|
|
332
332
|
if (data) {
|
|
333
|
+
const isFirstPage = request.params?.cursor == null;
|
|
333
334
|
const missingToolName = resolveMissingCapabilityToolName(data.options);
|
|
334
335
|
if (data.options.reportMissing) {
|
|
335
336
|
const alreadyPresent = tools.some((tool)=>tool?.name === missingToolName);
|
|
336
|
-
if (alreadyPresent) data.logger(`Warning: Cannot inject missing-capability tool "${missingToolName}" because a real tool already uses that name. The real tool will not be intercepted.`);
|
|
337
|
-
else {
|
|
337
|
+
if (isFirstPage && alreadyPresent) data.logger(`Warning: Cannot inject missing-capability tool "${missingToolName}" because a real tool already uses that name. The real tool will not be intercepted. To keep missing-capability reports, rename the SDK's tool with the missingCapabilityToolName option.`);
|
|
338
|
+
else if (isFirstPage) {
|
|
338
339
|
const virtualTool = getReportMissingToolDescriptor(missingToolName);
|
|
339
340
|
tools.push(virtualTool);
|
|
340
341
|
cacheToolAnalyticsParameterOwnership(data.toolAnalyticsParameterOwnership, [
|
|
341
342
|
virtualTool
|
|
342
343
|
]);
|
|
343
|
-
}
|
|
344
|
+
} else if (alreadyPresent) data.logger(`Warning: A real tool "${missingToolName}" on a later tools/list page is shadowed by the SDK's missing-capability tool. Its calls will be intercepted. Rename the SDK's tool with the missingCapabilityToolName option to keep both.`);
|
|
344
345
|
}
|
|
345
346
|
const feedbackOptions = resolveCollectFeedbackOptions(data.options.collectFeedback);
|
|
346
347
|
if (feedbackOptions) {
|
|
347
348
|
const feedbackToolName = feedbackOptions.toolName ?? SEND_FEEDBACK_TOOL_NAME;
|
|
348
349
|
const alreadyPresent = tools.some((tool)=>tool?.name === feedbackToolName);
|
|
349
|
-
const isFirstPage = request.params?.cursor == null;
|
|
350
350
|
if (isFirstPage && alreadyPresent) data.logger(`Warning: Cannot inject agent-feedback tool "${feedbackToolName}" because a real tool already uses that name. The real tool will not be intercepted. To collect feedback alongside it, rename the SDK's tool with collectFeedback: { toolName: "..." }.`);
|
|
351
351
|
else if (isFirstPage) {
|
|
352
352
|
const virtualTool = getFeedbackToolDescriptor(feedbackOptions);
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.16.
|
|
1
|
+
export declare const version = "0.16.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/dist/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = '0.16.
|
|
1
|
+
const version = '0.16.3';
|
|
2
2
|
export { version };
|
package/package.json
CHANGED
|
@@ -825,19 +825,32 @@ async function getTracedToolsList(
|
|
|
825
825
|
}
|
|
826
826
|
|
|
827
827
|
if (data) {
|
|
828
|
+
// A compliant client concatenates every page into one list, so only the
|
|
829
|
+
// first page — the one every client reads, including clients that never
|
|
830
|
+
// follow `nextCursor` — may carry a virtual tool. Presence, not
|
|
831
|
+
// truthiness: `cursor: ""` is a continuation page.
|
|
832
|
+
const isFirstPage = request.params?.cursor == null
|
|
833
|
+
|
|
828
834
|
const missingToolName = resolveMissingCapabilityToolName(data.options)
|
|
829
835
|
if (data.options.reportMissing) {
|
|
830
836
|
const alreadyPresent = tools.some((tool) => tool?.name === missingToolName)
|
|
831
|
-
if (alreadyPresent) {
|
|
837
|
+
if (isFirstPage && alreadyPresent) {
|
|
832
838
|
data.logger(
|
|
833
|
-
`Warning: Cannot inject missing-capability tool "${missingToolName}" because a real tool already uses that name. The real tool will not be intercepted.`
|
|
839
|
+
`Warning: Cannot inject missing-capability tool "${missingToolName}" because a real tool already uses that name. The real tool will not be intercepted. To keep missing-capability reports, rename the SDK's tool with the missingCapabilityToolName option.`
|
|
834
840
|
)
|
|
835
|
-
} else {
|
|
841
|
+
} else if (isFirstPage) {
|
|
836
842
|
const virtualTool = getReportMissingToolDescriptor(missingToolName)
|
|
837
843
|
tools.push(virtualTool)
|
|
838
844
|
// Cached separately because the virtual tool is added after the listing
|
|
839
845
|
// was cached, and its calls need ownership like any other tool's.
|
|
840
846
|
cacheToolAnalyticsParameterOwnership(data.toolAnalyticsParameterOwnership, [virtualTool])
|
|
847
|
+
} else if (alreadyPresent) {
|
|
848
|
+
// Conflicts are only detected on the pages a client actually
|
|
849
|
+
// fetches; a real owner here is already shadowed by the first-page
|
|
850
|
+
// injection, so the host must rename the SDK's tool.
|
|
851
|
+
data.logger(
|
|
852
|
+
`Warning: A real tool "${missingToolName}" on a later tools/list page is shadowed by the SDK's missing-capability tool. Its calls will be intercepted. Rename the SDK's tool with the missingCapabilityToolName option to keep both.`
|
|
853
|
+
)
|
|
841
854
|
}
|
|
842
855
|
}
|
|
843
856
|
|
|
@@ -845,11 +858,6 @@ async function getTracedToolsList(
|
|
|
845
858
|
if (feedbackOptions) {
|
|
846
859
|
const feedbackToolName = feedbackOptions.toolName ?? SEND_FEEDBACK_TOOL_NAME
|
|
847
860
|
const alreadyPresent = tools.some((tool) => tool?.name === feedbackToolName)
|
|
848
|
-
// A compliant client concatenates every page into one list, so only the
|
|
849
|
-
// first page — the one every client reads, including clients that never
|
|
850
|
-
// follow `nextCursor` — may carry the virtual tool. Presence, not
|
|
851
|
-
// truthiness: `cursor: ""` is a continuation page.
|
|
852
|
-
const isFirstPage = request.params?.cursor == null
|
|
853
861
|
if (isFirstPage && alreadyPresent) {
|
|
854
862
|
data.logger(
|
|
855
863
|
`Warning: Cannot inject agent-feedback tool "${feedbackToolName}" because a real tool already uses that name. The real tool will not be intercepted. To collect feedback alongside it, rename the SDK's tool with collectFeedback: { toolName: "..." }.`
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.16.
|
|
1
|
+
export const version = '0.16.3'
|