Skip to main content
Glama

Crossmint HR Airdrop MCP

by monostate

calculate_amounts

Calculate token amounts for employees based on uniform distribution or role-specific allocations using roleAmounts or uniformAmount inputs in the Crossmint HR Airdrop MCP server.

Instructions

Calculate token amounts for each employee

Input Schema

NameRequiredDescriptionDefault
roleAmountsNoToken amounts by role (if CSV with roles is used)
uniformAmountNoUniform amount for all employees (if no CSV role-mapping is used)

Input Schema (JSON Schema)

{ "properties": { "roleAmounts": { "description": "Token amounts by role (if CSV with roles is used)", "properties": { "VIP": { "type": "number" }, "VP": { "type": "number" }, "developer": { "type": "number" }, "manager": { "type": "number" }, "operational": { "type": "number" } }, "type": "object" }, "uniformAmount": { "description": "Uniform amount for all employees (if no CSV role-mapping is used)", "type": "number" } }, "type": "object" }

Implementation Reference

  • The main execution logic for the 'calculate_amounts' tool. Validates input, calculates token amounts per employee based on uniform or role-based allocation using defaults or provided values, updates employee state with tokenAmount, computes total, and returns formatted summary.
    private async handleCalculateAmounts(args: any) { if (this.state.employees.length === 0) { throw new McpError( ErrorCode.InvalidRequest, 'No employees added. Please generate wallets first.' ); } // Validate input const schema = z.object({ uniformAmount: z.number().positive().optional(), roleAmounts: z .object({ operational: z.number().positive().optional(), developer: z.number().positive().optional(), manager: z.number().positive().optional(), VP: z.number().positive().optional(), VIP: z.number().positive().optional(), }) .optional(), }); const { uniformAmount, roleAmounts } = schema.parse(args); // Set default role amounts if not provided const defaultRoleTokens = { operational: 100, developer: 200, manager: 300, vp: 400, vip: 500, }; // Combine with provided role amounts const roleTokens: Record<string, number> = { ...defaultRoleTokens, ...(roleAmounts || {}), }; let totalAmount = 0; // Update employee records with token amounts this.state.employees = this.state.employees.map((employee) => { let tokenAmount: number; if (uniformAmount) { // Use uniform amount for all employees tokenAmount = uniformAmount; } else if (employee.role) { // Use role-based amount if role is available const role = employee.role.toLowerCase(); if (role === 'operational') tokenAmount = roleTokens.operational || 100; else if (role === 'developer') tokenAmount = roleTokens.developer || 200; else if (role === 'manager') tokenAmount = roleTokens.manager || 300; else if (role === 'vp') tokenAmount = roleTokens.vp || 400; else if (role === 'vip') tokenAmount = roleTokens.vip || 500; else tokenAmount = 100; // Default fallback } else { // Default amount if no role specified tokenAmount = 100; } totalAmount += tokenAmount; return { ...employee, tokenAmount, }; }); return { content: [ { type: 'text', text: ` Token amounts calculated successfully: ${this.state.employees .map( (employee) => `- ${employee.name || employee.email}: ${employee.tokenAmount} tokens (${ employee.role || 'No role' })` ) .join('\n')} Total tokens to be distributed: ${totalAmount} ${ this.state.createdToken ? `Token supply: ${this.state.createdToken.supply}` : 'No token created yet. Please create a token with sufficient supply.' } Next step: Calculate gas fees for the airdrop. `.trim(), }, ], }; }
  • src/server.ts:235-258 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the tool name, description, and input schema for MCP clients to discover and call the tool.
    { name: 'calculate_amounts', description: 'Calculate token amounts for each employee', inputSchema: { type: 'object', properties: { uniformAmount: { type: 'number', description: 'Uniform amount for all employees (if no CSV role-mapping is used)', }, roleAmounts: { type: 'object', properties: { operational: { type: 'number' }, developer: { type: 'number' }, manager: { type: 'number' }, VP: { type: 'number' }, VIP: { type: 'number' }, }, description: 'Token amounts by role (if CSV with roles is used)', }, }, }, },
  • Zod validation schema inside the handler matching the tool's inputSchema for runtime parameter validation.
    const schema = z.object({ uniformAmount: z.number().positive().optional(), roleAmounts: z .object({ operational: z.number().positive().optional(), developer: z.number().positive().optional(), manager: z.number().positive().optional(), VP: z.number().positive().optional(), VIP: z.number().positive().optional(), }) .optional(), });
  • src/server.ts:328-329 (registration)
    Dispatch case in the CallToolRequestSchema switch statement that routes tool calls to the specific handler.
    case 'calculate_amounts': return await this.handleCalculateAmounts(args);

Other Tools

Related 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/monostate/Employees-Airdrop-Rewards-MCP'

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