bash
Execute bash commands on Scrapybara virtual Ubuntu instances to run code, automate tasks, and control remote environments through shell operations.
Instructions
Run a bash command in a Scrapybara instance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance_id | Yes | The ID of the instance to run the command on. | |
| command | Yes | The command to run in the instance shell. |
Implementation Reference
- src/index.ts:181-204 (handler)Handler for the 'bash' MCP tool: parses arguments using BashSchema, retrieves Scrapybara instance, calls instance.bash(command), and returns the response.case "bash": { const args = BashSchema.parse(request.params.arguments); const instance = await client.get(args.instance_id, { abortSignal: currentController.signal, }); if ("bash" in instance) { const response = await instance.bash( { command: args.command }, { abortSignal: currentController.signal } ); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), } as TextContent, ], }; } else { throw new Error("Instance does not support bash commands"); } }
- src/schemas.ts:18-23 (schema)Zod schema defining input for bash tool: instance_id (string) and command (string). Used for validation in handler and JSON schema in registration.export const BashSchema = z.object({ instance_id: z .string() .describe("The ID of the instance to run the command on."), command: z.string().describe("The command to run in the instance shell."), });
- src/index.ts:89-92 (registration)Tool registration in listTools response: defines name 'bash', description, and input schema derived from BashSchema.name: "bash", description: "Run a bash command in a Scrapybara instance.", inputSchema: zodToJsonSchema(BashSchema), },