Skip to main content
Glama

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
NameRequiredDescriptionDefault
encounterIdYes
showLegendNo
showCoordinatesNo
showElevationNo
viewportNo
focusOnNo
legendDetailNostandard

Implementation Reference

  • 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);
        }
      },
    },
  • 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);
      }

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/Mnehmos/ChatRPG'

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