create_map
Create a new map in your RPG Maker MZ project by specifying map ID, name, and dimensions to build game worlds and environments.
Instructions
Create a new map in the project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| height | No | Map height in tiles (default: 13) | |
| map_id | Yes | Map ID number | |
| name | Yes | Map name | |
| project_path | Yes | Path to the RPG Maker MZ project directory | |
| width | No | Map width in tiles (default: 17) |
Implementation Reference
- src/game-creation-tools.ts:120-150 (handler)Core handler function that executes the map creation logic: validates parameters, updates MapInfos.json with new map info, generates default map data, and writes the new MapXXX.json file.export async function createMap(projectPath: string, mapId: number, name: string, width = 17, height = 13) { try { // Validate inputs await validateProjectPath(projectPath); Validator.requirePositiveNumber(mapId, "map_id"); Validator.requireString(name, "name"); Validator.requirePositiveNumber(width, "width"); Validator.requirePositiveNumber(height, "height"); await Logger.info("Creating map", { projectPath, mapId, name, width, height }); // Read MapInfos const mapInfosPath = path.join(projectPath, "data", "MapInfos.json"); const mapInfos = await FileHelper.readJSON(mapInfosPath); // Add new map info mapInfos[mapId] = getDefaultMapInfo(mapId, name); await FileHelper.writeJSON(mapInfosPath, mapInfos); // Create map file const map = getDefaultMap(mapId, name, width, height); const mapFilename = `Map${String(mapId).padStart(3, "0")}.json`; await FileHelper.writeJSON(path.join(projectPath, "data", mapFilename), map); await Logger.info("Map created successfully", { mapId, name }); return { success: true, mapId, name }; } catch (error) { await Logger.error("Failed to create map", { projectPath, mapId, name, error }); return createErrorResponse(error); } }
- src/index.ts:227-255 (schema)Tool schema definition including name, description, and input schema for the 'create_map' MCP tool, used in ListTools response.name: "create_map", description: "Create a new map in the project", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to the RPG Maker MZ project directory", }, map_id: { type: "number", description: "Map ID number", }, name: { type: "string", description: "Map name", }, width: { type: "number", description: "Map width in tiles (default: 17)", }, height: { type: "number", description: "Map height in tiles (default: 13)", }, }, required: ["project_path", "map_id", "name"], }, },
- src/index.ts:1154-1164 (handler)MCP CallTool request handler for 'create_map': extracts arguments from request, calls the core createMap function, and returns the result as text content.case "create_map": { const projectPath = args.project_path as string; const mapId = args.map_id as number; const name = args.name as string; const width = (args.width as number) || 17; const height = (args.height as number) || 13; const result = await createMap(projectPath, mapId, name, width, height); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
- src/index.ts:11-13 (helper)Import statement that brings the createMap helper function into the MCP server scope.createNewProject, createMap, updateMapTile,