delete_world
Delete Minecraft world folders permanently when the server is stopped. Requires confirmation to prevent accidental data loss. Always create backups before using this irreversible action.
Instructions
Delete a world folder. WARNING: This is irreversible! Consider creating a backup first. The server must be stopped.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| world_name | Yes | World folder name to delete | |
| confirm | Yes | Must be true to confirm deletion |
Implementation Reference
- src/tools/world-tools.ts:102-164 (handler)The `delete_world` tool handler logic, which checks for the confirmation flag and server status before calling the `WorldManager` to perform the deletion.
server.tool( "delete_world", "Delete a world folder. WARNING: This is irreversible! Consider creating a backup first. The server must be stopped.", { world_name: z.string().describe("World folder name to delete"), confirm: z .boolean() .describe("Must be true to confirm deletion"), }, async ({ world_name, confirm }) => { if (!confirm) { return { content: [ { type: "text", text: "Deletion cancelled. Set confirm=true to proceed.", }, ], }; } if (manager.isRunning()) { return { content: [ { type: "text", text: "Cannot delete a world while the server is running. Stop the server first.", }, ], isError: true, }; } try { const deleted = worldManager.deleteWorld(world_name); if (deleted) { return { content: [ { type: "text", text: `World "${world_name}" has been deleted.`, }, ], }; } return { content: [ { type: "text", text: `World "${world_name}" not found.` }, ], isError: true, }; } catch (error) { return { content: [ { type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } - src/tools/world-tools.ts:103-103 (registration)Registration of the `delete_world` tool name in the MCP server.
"delete_world", - src/core/WorldManager.ts:115-116 (helper)The underlying `WorldManager.deleteWorld` method that performs the actual file system deletion.
deleteWorld(worldName: string): boolean { // Safety: prevent path traversal