Skip to main content
Glama

manage_party

Organize RPG party composition by adding, removing, or assigning roles to characters, and view the current roster.

Instructions

Manage party composition. Operations: add (add character to party with optional role), remove (remove character from party), list (show party roster), get (get party member details), set_role (assign role to party member), clear (remove all members). Roles: leader, scout, healer, tank, support, damage, utility, other.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationNo
characterIdNo
characterNameNo
roleNo

Implementation Reference

  • The main handler function for the 'manage_party' tool. Parses input using managePartySchema, dispatches to specific operation handlers (add, remove, list, get, set_role, clear), formats output as ASCII box, and handles Zod validation errors.
    export async function manageParty(input: unknown): Promise<{ content: { type: 'text'; text: string }[] }> {
      try {
        const parsed = managePartySchema.parse(input);
    
        let result: string;
    
        switch (parsed.operation) {
          case 'add':
            result = handlePartyAdd(parsed);
            break;
          case 'remove':
            result = handlePartyRemove(parsed);
            break;
          case 'list':
            result = handlePartyList();
            break;
          case 'get':
            result = handlePartyGet(parsed);
            break;
          case 'set_role':
            result = handlePartySetRole(parsed);
            break;
          case 'clear':
            result = handlePartyClear();
            break;
          default:
            result = createBox('ERROR', ['Unknown operation'], DISPLAY_WIDTH);
        }
    
        return { content: [{ type: 'text' as const, text: result }] };
      } catch (error) {
        const lines: string[] = [];
    
        if (error instanceof z.ZodError) {
          for (const issue of error.issues) {
            lines.push(`${issue.path.join('.')}: ${issue.message}`);
          }
        } else if (error instanceof Error) {
          lines.push(error.message);
        } else {
          lines.push('An unknown error occurred');
        }
    
        return { content: [{ type: 'text' as const, text: createBox('ERROR', lines, DISPLAY_WIDTH) }] };
      }
    }
  • Zod schema defining input validation for manage_party tool using discriminated union on 'operation' field for add/remove/list/get/set_role/clear operations.
    export const managePartySchema = z.discriminatedUnion('operation', [
      addPartyOperationSchema,
      removePartyOperationSchema,
      listPartyOperationSchema,
      getPartyMemberOperationSchema,
      setRoleOperationSchema,
      clearPartyOperationSchema,
    ]);
  • Tool registration in the central registry, defining name, description, input schema conversion, and wrapper handler that calls the manageParty function with error handling.
    manage_party: {
      name: 'manage_party',
      description: 'Manage party composition. Operations: add (add character to party with optional role), remove (remove character from party), list (show party roster), get (get party member details), set_role (assign role to party member), clear (remove all members). Roles: leader, scout, healer, tank, support, damage, utility, other.',
      inputSchema: toJsonSchema(managePartySchema),
      handler: async (args) => {
        try {
          const result = await manageParty(args);
          return 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);
        }
      },
    },
  • Example helper: handlePartyAdd - Resolves character ID, checks if already in party, adds to partyMemberStore with role, formats output.
    function handlePartyAdd(input: z.infer<typeof addPartyOperationSchema>): string {
      const resolved = resolveCharacterId(input.characterId, input.characterName);
    
      if (!resolved.id) {
        return createBox('ERROR', [resolved.error || 'Character not found'], DISPLAY_WIDTH);
      }
    
      // Check if already in party
      if (partyMemberStore.has(resolved.id)) {
        const charResult = getCharacter({ characterId: resolved.id });
        const name = charResult.character?.name || resolved.id;
        return createBox('ERROR', [`${name} is already in the party.`], DISPLAY_WIDTH);
      }
    
      // Get character info for display
      const charResult = getCharacter({ characterId: resolved.id });
      const character = charResult.character;
    
      // Add to party
      const member: PartyMember = {
        characterId: resolved.id,
        characterName: character?.name || resolved.id,
        role: input.role,
        joinedAt: new Date().toISOString(),
      };
      partyMemberStore.set(resolved.id, member);
    
      const lines: string[] = [];
      lines.push(`Name: ${character?.name || resolved.id}`);
      if (character) {
        lines.push(`Class: ${character.class} (Level ${character.level})`);
      }
      if (input.role) {
        lines.push(`Role: ${input.role}`);
      }
      lines.push('');
      lines.push(`Party size: ${partyMemberStore.size}`);
    
      return createBox('PARTY MEMBER ADDED', lines, DISPLAY_WIDTH);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It lists operations but does not explain critical behaviors such as permissions required, whether changes are persistent, error handling, or response formats. For a mutation tool with multiple operations, this leaves significant gaps in understanding how it behaves beyond basic actions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the purpose, followed by a bullet-like list of operations and roles, all in two efficient sentences. Every element earns its place by clarifying functionality without redundancy, making it easy to scan and understand.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (multiple operations, 4 parameters with 0% schema coverage, no output schema, and no annotations), the description is incomplete. It outlines operations but fails to cover parameter details, behavioral traits, or output expectations, leaving the agent with insufficient information for reliable invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions parameters indirectly (e.g., 'characterId', 'role' in operations) but does not explicitly define them, their relationships, or constraints. For 4 parameters with no schema documentation, this adds minimal semantic value beyond implying usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Manage party composition' and enumerates six specific operations (add, remove, list, get, set_role, clear) with their functions, distinguishing it from siblings like manage_character or manage_encounter. It specifies the resource (party) and actions, avoiding tautology.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by listing operations and roles, providing context for when to use each operation (e.g., 'add' for adding characters, 'clear' for removing all). However, it lacks explicit guidance on when to choose this tool over alternatives like manage_character or manage_encounter, and does not specify prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/mnehmos.chatrpg.game'

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