Skip to main content
Glama
by fakepixels

process_command

Execute natural language commands for Base network operations, enabling wallet management, balance checks, and transaction execution through LLM-powered automation.

Instructions

Process a natural language command for Base network operations

Input Schema

NameRequiredDescriptionDefault
commandYesNatural language command (e.g., "Send 0.1 ETH to 0x123...")

Input Schema (JSON Schema)

{ "properties": { "command": { "description": "Natural language command (e.g., \"Send 0.1 ETH to 0x123...\")", "type": "string" } }, "required": [ "command" ], "type": "object" }

Implementation Reference

  • The core handler function that implements the logic for the 'process_command' tool. It uses NLP to parse the command and dispatches to blockchain-specific handlers.
    export async function processNaturalLanguageCommand(command: string): Promise<any> { try { // Parse the command const parsedCommand = parseCommand(command); console.log(`Parsed command: ${JSON.stringify(parsedCommand)}`); // Generate human-readable description const description = generateCommandDescription(parsedCommand); console.log(`Command description: ${description}`); // Process based on intent switch (parsedCommand.intent) { case CommandIntent.SEND_TRANSACTION: return await handleSendTransaction(parsedCommand.parameters as SendTransactionArgs); case CommandIntent.CHECK_BALANCE: return await handleCheckBalance(parsedCommand.parameters as CheckBalanceArgs); case CommandIntent.CREATE_WALLET: return await handleCreateWallet(parsedCommand.parameters as CreateWalletArgs); case CommandIntent.UNKNOWN: default: return { success: false, message: `I couldn't understand that command. Try something like "Send 0.1 ETH to 0x123..." or "Create a new wallet".`, originalCommand: command }; } } catch (error) { console.error('Error processing command:', error); return { success: false, message: `Error processing command: ${error instanceof Error ? error.message : 'Unknown error'}`, originalCommand: command }; } }
  • Tool definition including schema for 'process_command' in the MCP ListToolsRequestSchema response.
    name: 'process_command', description: 'Process a natural language command for Base network operations', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'Natural language command (e.g., "Send 0.1 ETH to 0x123...")', }, }, required: ['command'], },
  • Handler case in MCP CallToolRequestSchema that validates input and invokes the core processNaturalLanguageCommand function.
    case 'process_command': { if (typeof args.command !== 'string' || !args.command) { throw new McpError( ErrorCode.InvalidParams, 'Command is required and must be a string' ); } const result = await toolHandlers.processNaturalLanguageCommand( args.command ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Registration of the processNaturalLanguageCommand function within the toolHandlers object imported and used by the MCP server.
    export const toolHandlers = { processNaturalLanguageCommand, handleSendTransaction, handleCheckBalance, handleCreateWallet, handleListWallets };

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fakepixels/base-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server