@exreve/exk 1.0.32 → 1.0.33
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/agentSession.js +1 -1
- package/dist/test-mcp-tool.js +50 -0
- package/dist/ttc-cli.tar.gz +0 -0
- package/package.json +1 -1
package/dist/agentSession.js
CHANGED
|
@@ -512,7 +512,7 @@ export class AgentSessionManager {
|
|
|
512
512
|
// Create a fresh MCP server for each query call (SDK connects transport internally, cannot reuse)
|
|
513
513
|
...(() => {
|
|
514
514
|
const mcpServer = this.buildMcpServer(sessionId, attachmentDir);
|
|
515
|
-
return { mcpServers:
|
|
515
|
+
return { mcpServers: { 'claude-voice-modules': mcpServer } };
|
|
516
516
|
})(),
|
|
517
517
|
...(pathToClaudeCodeExecutable ? { pathToClaudeCodeExecutable } : {}),
|
|
518
518
|
spawnClaudeCodeProcess: (spawnOptions) => {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test: verify that a custom MCP tool is visible to the Claude Agent SDK.
|
|
3
|
+
* Usage: npx tsx test-mcp-tool.ts
|
|
4
|
+
*/
|
|
5
|
+
import { query, createSdkMcpServer, tool } from '@anthropic-ai/claude-agent-sdk';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import fs from 'fs';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import os from 'os';
|
|
10
|
+
const AI_CONFIG = JSON.parse(fs.readFileSync(path.join(os.homedir(), '.talk-to-code', 'ai-config.json'), 'utf-8'));
|
|
11
|
+
// Create a trivial test tool
|
|
12
|
+
const mcpServer = createSdkMcpServer({
|
|
13
|
+
name: 'test-tools',
|
|
14
|
+
version: '1.0.0',
|
|
15
|
+
tools: [
|
|
16
|
+
tool('analyze_image', 'Analyze an image file. Returns a text description.', {
|
|
17
|
+
image_path: z.string().describe('Path to image'),
|
|
18
|
+
question: z.string().describe('What to answer about the image'),
|
|
19
|
+
}, async (args) => ({
|
|
20
|
+
content: [{ type: 'text', text: `[TEST] Would analyze ${args.image_path} with question: ${args.question}` }],
|
|
21
|
+
})),
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
console.log('=== MCP server created ===');
|
|
25
|
+
// Now run a query with the CORRECT format (Record<string, config>)
|
|
26
|
+
console.log('\n--- Running query (mcpServers as Record) ---');
|
|
27
|
+
const q = query({
|
|
28
|
+
prompt: 'List every tool you have available by name. Specifically, do you have an "analyze_image" tool? Just answer with the list.',
|
|
29
|
+
options: {
|
|
30
|
+
apiKey: AI_CONFIG.authToken,
|
|
31
|
+
model: AI_CONFIG.model,
|
|
32
|
+
cwd: '/tmp',
|
|
33
|
+
permissionMode: 'bypassPermissions',
|
|
34
|
+
allowDangerouslySkipPermissions: true,
|
|
35
|
+
disallowedTools: ['AskUserQuestion', 'analyze_image'],
|
|
36
|
+
mcpServers: { 'claude-voice-modules': mcpServer },
|
|
37
|
+
maxTurns: 2,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
for await (const event of q) {
|
|
41
|
+
if (event.type === 'assistant') {
|
|
42
|
+
const text = event.message?.content
|
|
43
|
+
?.filter((b) => b.type === 'text')
|
|
44
|
+
?.map((b) => b.text)
|
|
45
|
+
?.join('') || '';
|
|
46
|
+
if (text)
|
|
47
|
+
console.log('Agent:', text);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
console.log('\n--- Done ---');
|
package/dist/ttc-cli.tar.gz
CHANGED
|
Binary file
|