File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,26 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
44
55import { 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+
722async 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
You can’t perform that action at this time.
0 commit comments