Skip to main content
Glama

manage_condition

Track and modify D&D 5e conditions on characters during gameplay, including adding, removing, querying status, and managing durations for streamlined combat management.

Instructions

Manage D&D 5e conditions on targets (add, remove, query, tick duration)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetIdNo
encounterIdNo
operationNo
conditionNo
sourceNo
descriptionNo
durationNo
saveDCNo
saveAbilityNo
exhaustionLevelsNo
roundNumberNo
batchNo

Implementation Reference

  • Registration of the manage_condition tool, including name, description, input schema conversion from Zod schema, and a validating handler that delegates to the manageCondition function.
    manage_condition: {
      name: 'manage_condition',
      description: 'Manage D&D 5e conditions on targets (add, remove, query, tick duration)',
      inputSchema: toJsonSchema(manageConditionSchema),
      handler: async (args) => {
        try {
          const validated = manageConditionSchema.parse(args);
          const result = manageCondition(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 tool handler function which performs Zod validation on input arguments and executes the core manageCondition logic, returning success or formatted error.
    handler: async (args) => {
      try {
        const validated = manageConditionSchema.parse(args);
        const result = manageCondition(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);
      }
  • Import statement bringing in the manageConditionSchema (Zod schema for input validation) and manageCondition (core handler function) from the combat module.
    import { manageCondition, manageConditionSchema, createEncounter, createEncounterSchema, executeAction, executeActionSchema, advanceTurn, advanceTurnSchema, rollDeathSave, rollDeathSaveSchema, modifyTerrain, modifyTerrainSchema, renderBattlefield, renderBattlefieldSchema, getEncounter, getEncounterSchema, endEncounter, endEncounterSchema, manageEncounter, manageEncounterSchema } from './modules/combat.js';
  • Delegation to the core manageCondition helper function after schema validation. The actual condition management logic resides here.
    const validated = manageConditionSchema.parse(args);
    const result = manageCondition(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