render_battlefield
Visualize combat scenarios in text-based grids to display participant positions, obstacles, and terrain for tactical planning.
Instructions
Render an ASCII map of the current combat state showing participant positions, obstacles, and terrain. Returns a text-based grid visualization.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| encounterId | Yes | ||
| showLegend | No | ||
| showCoordinates | No | ||
| showElevation | No | ||
| viewport | No | ||
| focusOn | No | ||
| legendDetail | No | standard |
Implementation Reference
- src/registry.ts:880-898 (registration)Registration of the 'render_battlefield' MCP tool. Defines name, description, input schema (using imported renderBattlefieldSchema), and handler function that parses input with the schema and executes renderBattlefield(validated) to generate the result.render_battlefield: { name: 'render_battlefield', description: 'Render an ASCII map of the current combat state showing participant positions, obstacles, and terrain. Returns a text-based grid visualization.', inputSchema: toJsonSchema(renderBattlefieldSchema), handler: async (args) => { try { const validated = renderBattlefieldSchema.parse(args); const result = renderBattlefield(validated); return success(result); } catch (err) { if (err instanceof z.ZodError) { const messages = err.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', '); return error(`Validation failed: ${messages}`); } const message = err instanceof Error ? err.message : String(err); return error(message); } }, },
- src/registry.ts:884-896 (handler)The MCP tool handler for render_battlefield. Validates arguments using renderBattlefieldSchema and calls the core renderBattlefield function with validated args, returning success(result). Handles Zod validation errors and other exceptions.handler: async (args) => { try { const validated = renderBattlefieldSchema.parse(args); const result = renderBattlefield(validated); return success(result); } catch (err) { if (err instanceof z.ZodError) { const messages = err.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', '); return error(`Validation failed: ${messages}`); } const message = err instanceof Error ? err.message : String(err); return error(message); }