Skip to content

Commit 94b165f

Browse files
committed
Tools arg
1 parent 46c106f commit 94b165f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/index.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
44

55
import { AgentMailToolkit } from 'agentmail-toolkit/mcp'
66

7+
function parseToolsArg(): string[] | undefined {
8+
const args = process.argv.slice(2)
9+
10+
const toolsIndex = args.indexOf('--tools')
11+
if (toolsIndex === -1) return undefined
12+
13+
const toolsArg = args[toolsIndex + 1]
14+
if (!toolsArg) {
15+
console.error('Error: --tools flag requires a comma-separated list of tool names')
16+
process.exit(1)
17+
}
18+
19+
return toolsArg.split(',').map((tool) => tool.trim())
20+
}
21+
722
async function main() {
823
const server = new McpServer({ name: 'AgentMail', version: '0.1.0' })
924
const transport = new StdioServerTransport()
1025

11-
for (const tool of new AgentMailToolkit().getTools()) {
26+
for (const tool of new AgentMailToolkit().getTools(parseToolsArg())) {
1227
server.tool(tool.name, tool.description, tool.paramsSchema, tool.callback)
1328
}
1429

0 commit comments

Comments
 (0)