Skip to main content
Glama

execute_command

Execute shell commands on your system to automate tasks, run scripts, or perform system operations through direct command line access.

Instructions

Execute shell commands on the system. SECURITY WARNING: This tool provides direct system access. Only use with trusted commands. Commands run with the same permissions as the MCP server process.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesThe shell command to execute
workingDirectoryNoThe working directory for command execution (optional)

Implementation Reference

  • The handler logic for the 'execute_command' tool. It executes the provided shell command using Node.js child_process.exec (promisified as execAsync), optionally in a specified working directory, and returns stdout, stderr, and success status.
    case "execute_command": { const command = args.command as string; const workingDirectory = args.workingDirectory as string | undefined; const options = workingDirectory ? { cwd: workingDirectory } : {}; const { stdout, stderr } = await execAsync(command, options); return { content: [ { type: "text", text: JSON.stringify( { stdout: stdout, stderr: stderr, success: true, }, null, 2 ), }, ], }; }
  • src/index.ts:172-189 (registration)
    Registration of the 'execute_command' tool in the TOOLS array, including name, description, and input schema. This is used by the listTools handler.
    { name: "execute_command", description: "Execute shell commands on the system. SECURITY WARNING: This tool provides direct system access. Only use with trusted commands. Commands run with the same permissions as the MCP server process.", inputSchema: { type: "object", properties: { command: { type: "string", description: "The shell command to execute", }, workingDirectory: { type: "string", description: "The working directory for command execution (optional)", }, }, required: ["command"], }, },

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/koopatroopa787/first_mcp'

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