Skip to main content
Glama

create_character

Generate a complete D&D 5e character with customizable stats, class, race, equipment, and abilities for tabletop roleplaying games.

Instructions

Create a new D&D 5e character with stats, class, race, and equipment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
raceNoHuman
classNoFighter
levelNo
backgroundNo
characterTypeNopc
statsNo
hpNo
maxHpNo
acNo
speedNo
resistancesNo
immunitiesNo
vulnerabilitiesNo
conditionImmunitiesNo
spellcastingAbilityNo
knownSpellsNo
preparedSpellsNo
cantripsNo
skillProficienciesNo
saveProficienciesNo
equipmentNo
customClassNo
customRaceNo

Implementation Reference

  • The handler function for the 'create_character' tool. It parses the input arguments using createCharacterSchema, calls the createCharacter function with validated args, and returns a success response with the generated markdown or handles validation/runtime errors.
    handler: async (args) => { try { const validated = createCharacterSchema.parse(args); const result = createCharacter(validated); return success(result.markdown); } 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 registration entry for the 'create_character' tool in the toolRegistry, defining name, description, input schema (converted from Zod schema), and the handler function.
    create_character: { name: 'create_character', description: 'Create a new D&D 5e character with stats, class, race, and equipment', inputSchema: toJsonSchema(createCharacterSchema), handler: async (args) => { try { const validated = createCharacterSchema.parse(args); const result = createCharacter(validated); return success(result.markdown); } 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); } }, },
  • Usage of createCharacterSchema for input validation within the handler. The schema itself is imported from './modules/characters.js'.
    const validated = createCharacterSchema.parse(args);
  • Call to the createCharacter helper function, which implements the core logic for creating a D&D 5e character and returns {markdown: string}.
    const result = createCharacter(validated);

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