Skip to main content
Glama

manage_concentration

Track and manage D&D 5e spell concentration, including setting concentration, checking saves after damage, and ending concentration with proper DC calculations.

Instructions

Manage D&D 5e concentration on spells. Operations: set (begin concentrating), get (query state), check (roll save after damage), break (end concentration). DC = max(10, damage/2). Supports advantage/disadvantage on saves.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
characterIdNo
operationNo
spellNameNo
targetsNo
durationNo
reasonNo
damageNo
conSaveModifierNo
rollModeNo
manualRollNo
manualRollsNo

Implementation Reference

  • Main handler function for the manage_concentration tool. Dispatches to operation-specific handlers (set, get, break, check) based on input.operation. Returns ASCII-formatted result string.
    export function manageConcentration(input: ManageConcentrationInput): string { switch (input.operation) { case 'set': return handleSetConcentration(input); case 'get': return handleGetConcentration(input); case 'break': return handleBreakConcentration(input); case 'check': return handleCheckConcentration(input); default: // TypeScript exhaustiveness check const _exhaustive: never = input; throw new Error(`Unknown operation: ${(_exhaustive as { operation: string }).operation}`); } }
  • Zod schema defining the input for manage_concentration tool as a discriminated union of four operations: set (begin concentration), get (query state), break (end concentration), check (save after damage).
    /** * Combined schema for all manage_concentration operations. * Supports: set, get, break, check */ export const manageConcentrationSchema = z.union([ setOperationSchema, getOperationSchema, breakOperationSchema, checkOperationSchema, ]); export type ManageConcentrationInput = z.infer<typeof manageConcentrationSchema>;
  • Tool registration in the central registry. Defines name, description, converts Zod schema to JSON Schema for MCP, and provides an async wrapper handler that parses input with manageConcentrationSchema and calls the main manageConcentration function.
    manage_concentration: { name: 'manage_concentration', description: 'Manage D&D 5e concentration on spells. Operations: set (begin concentrating), get (query state), check (roll save after damage), break (end concentration). DC = max(10, damage/2). Supports advantage/disadvantage on saves.', inputSchema: toJsonSchema(manageConcentrationSchema), handler: async (args) => { try { const validated = manageConcentrationSchema.parse(args); const result = manageConcentration(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