Skip to main content
Glama

add_event

Create new events on RPG Maker MZ maps by specifying coordinates, IDs, and names to build interactive game elements and narrative content.

Instructions

Add a new event to a map

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
event_idYesEvent ID
map_idYesMap ID
nameYesEvent name
project_pathYesPath to the RPG Maker MZ project directory
xYesX coordinate
yYesY coordinate

Implementation Reference

  • The core handler function that implements the 'add_event' tool logic. Loads the map JSON file, creates a default event object, inserts it into the map's events array at the specified eventId, and saves the updated map file.
    export async function addEvent(
      projectPath: string,
      mapId: number,
      eventId: number,
      name: string,
      x: number,
      y: number
    ) {
      const mapFilename = `Map${String(mapId).padStart(3, "0")}.json`;
      const mapPath = path.join(projectPath, "data", mapFilename);
      const mapContent = await fs.readFile(mapPath, "utf-8");
      const map = JSON.parse(mapContent);
    
      const event = getDefaultEvent(eventId, name, x, y);
      map.events[eventId] = event;
    
      await fs.writeFile(mapPath, JSON.stringify(map, null, 0), "utf-8");
      return { success: true, eventId };
    }
  • The input schema and metadata definition for the 'add_event' tool, provided in the MCP server's listTools response.
    {
      name: "add_event",
      description: "Add a new event to a map",
      inputSchema: {
        type: "object",
        properties: {
          project_path: {
            type: "string",
            description: "Path to the RPG Maker MZ project directory",
          },
          map_id: {
            type: "number",
            description: "Map ID",
          },
          event_id: {
            type: "number",
            description: "Event ID",
          },
          name: {
            type: "string",
            description: "Event name",
          },
          x: {
            type: "number",
            description: "X coordinate",
          },
          y: {
            type: "number",
            description: "Y coordinate",
          },
        },
        required: ["project_path", "map_id", "event_id", "name", "x", "y"],
      },
    },
  • src/index.ts:1179-1189 (registration)
    The registration and dispatching logic in the MCP server's CallToolRequest handler that extracts parameters from the tool call and invokes the addEvent handler function.
    case "add_event": {
      const projectPath = args.project_path as string;
      const mapId = args.map_id as number;
      const eventId = args.event_id as number;
      const name = args.name as string;
      const x = args.x as number;
      const y = args.y as number;
      const result = await addEvent(projectPath, mapId, eventId, name, x, y);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };

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/ShunsukeHayashi/rpgmaker-mz-mcp'

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