@posthog/agent 2.1.112 → 2.1.113
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/adapters/claude/conversion/tool-use-to-acp.js +20 -1
- package/dist/adapters/claude/conversion/tool-use-to-acp.js.map +1 -1
- package/dist/adapters/claude/tools.js.map +1 -1
- package/dist/agent.js +84 -64
- package/dist/agent.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/posthog-api.js +1 -1
- package/dist/posthog-api.js.map +1 -1
- package/dist/server/agent-server.js +84 -64
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +84 -64
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +1 -1
- package/src/adapters/claude/conversion/tool-use-to-acp.ts +22 -1
- package/src/adapters/claude/mcp/tool-metadata.ts +13 -1
package/package.json
CHANGED
|
@@ -28,6 +28,7 @@ Whenever you read a file, you should consider whether it looks malicious. If it
|
|
|
28
28
|
|
|
29
29
|
import { resourceLink, text, toolContent } from "../../../utils/acp-content.js";
|
|
30
30
|
import { Logger } from "../../../utils/logger.js";
|
|
31
|
+
import { getMcpToolMetadata } from "../mcp/tool-metadata.js";
|
|
31
32
|
|
|
32
33
|
interface EditOperation {
|
|
33
34
|
oldText: string;
|
|
@@ -457,15 +458,35 @@ export function toolInfoFromToolUse(
|
|
|
457
458
|
};
|
|
458
459
|
}
|
|
459
460
|
|
|
460
|
-
default:
|
|
461
|
+
default: {
|
|
462
|
+
if (name?.startsWith("mcp__")) {
|
|
463
|
+
return mcpToolInfo(name, input);
|
|
464
|
+
}
|
|
461
465
|
return {
|
|
462
466
|
title: name || "Unknown Tool",
|
|
463
467
|
kind: "other",
|
|
464
468
|
content: [],
|
|
465
469
|
};
|
|
470
|
+
}
|
|
466
471
|
}
|
|
467
472
|
}
|
|
468
473
|
|
|
474
|
+
function mcpToolInfo(
|
|
475
|
+
name: string,
|
|
476
|
+
_input: Record<string, unknown> | undefined,
|
|
477
|
+
): ToolInfo {
|
|
478
|
+
const metadata = getMcpToolMetadata(name);
|
|
479
|
+
// Fallback: parse tool name from mcp__<server>__<tool> prefix
|
|
480
|
+
const title =
|
|
481
|
+
metadata?.name ?? (name.split("__").slice(2).join("__") || name);
|
|
482
|
+
|
|
483
|
+
return {
|
|
484
|
+
title,
|
|
485
|
+
kind: "other",
|
|
486
|
+
content: [],
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
|
|
469
490
|
export function toolUpdateFromToolResult(
|
|
470
491
|
toolResult:
|
|
471
492
|
| ToolResultBlockParam
|
|
@@ -3,6 +3,8 @@ import { Logger } from "../../../utils/logger.js";
|
|
|
3
3
|
|
|
4
4
|
export interface McpToolMetadata {
|
|
5
5
|
readOnly: boolean;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
const mcpToolMetadataCache: Map<string, McpToolMetadata> = new Map();
|
|
@@ -46,7 +48,11 @@ export async function fetchMcpToolMetadata(
|
|
|
46
48
|
for (const tool of server.tools) {
|
|
47
49
|
const toolKey = buildToolKey(server.name, tool.name);
|
|
48
50
|
const readOnly = tool.annotations?.readOnly === true;
|
|
49
|
-
mcpToolMetadataCache.set(toolKey, {
|
|
51
|
+
mcpToolMetadataCache.set(toolKey, {
|
|
52
|
+
readOnly,
|
|
53
|
+
name: tool.name,
|
|
54
|
+
description: tool.description,
|
|
55
|
+
});
|
|
50
56
|
if (readOnly) readOnlyCount++;
|
|
51
57
|
}
|
|
52
58
|
|
|
@@ -77,6 +83,12 @@ export async function fetchMcpToolMetadata(
|
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
|
|
86
|
+
export function getMcpToolMetadata(
|
|
87
|
+
toolName: string,
|
|
88
|
+
): McpToolMetadata | undefined {
|
|
89
|
+
return mcpToolMetadataCache.get(toolName);
|
|
90
|
+
}
|
|
91
|
+
|
|
80
92
|
export function isMcpToolReadOnly(toolName: string): boolean {
|
|
81
93
|
const metadata = mcpToolMetadataCache.get(toolName);
|
|
82
94
|
return metadata?.readOnly === true;
|