Skip to main content
Glama

calculate_labor_cost

Calculate labor costs for a specific period using employee hours and rates to manage payroll expenses and budget planning.

Instructions

Calculate labor costs for a specific period based on employee hours and rates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endDateYesEnd date in YYYY-MM-DD format
startDateYesStart date in YYYY-MM-DD format

Implementation Reference

  • Input schema definition for the calculate_labor_cost tool, specifying required startDate and endDate parameters.
    { name: 'calculate_labor_cost', description: 'Calculate labor costs for a specific period based on employee hours and rates.', inputSchema: { type: 'object', properties: { startDate: { type: 'string', description: 'Start date in YYYY-MM-DD format' }, endDate: { type: 'string', description: 'End date in YYYY-MM-DD format' }, }, required: ['startDate', 'endDate'], }, },
  • The handler function that implements calculate_labor_cost logic. It computes the number of days between startDate and endDate, then calculates total labor cost by summing estimated weekly costs prorated over the period for each employee using their hourlyRate assuming 40 hours/week.
    case 'calculate_labor_cost': { const startDate = String(args?.startDate || ''); const endDate = String(args?.endDate || ''); const days = Math.ceil((new Date(endDate).getTime() - new Date(startDate).getTime()) / (1000 * 60 * 60 * 24)); const totalCost = storeData.employees.reduce((sum, emp) => sum + (emp.hourlyRate * 40 * days / 7), 0); return { content: [{ type: 'text', text: `💰 Labor Cost Analysis\n📅 Period: ${startDate} to ${endDate} (${days} days)\n\n${storeData.employees.map(emp => `${emp.name}: $${(emp.hourlyRate * 40 * days / 7).toFixed(2)}` ).join('\n')}\n\n💵 Total Labor Cost: $${totalCost.toFixed(2)}\n📊 Daily Average: $${(totalCost / days).toFixed(2)}` }] }; }
  • Mock employee data used in the labor cost calculation, providing names and hourly rates for cost computation.
    employees: [ { id: 'EMP001', name: 'Alex Johnson', role: 'Store Manager', shift: 'Mon-Fri 9AM-6PM', hourlyRate: 22 }, { id: 'EMP002', name: 'Maria Santos', role: 'Sales Associate', shift: 'Tue-Sat 10AM-7PM', hourlyRate: 16 }, { id: 'EMP003', name: 'David Kim', role: 'Art Specialist', shift: 'Wed-Sun 11AM-8PM', hourlyRate: 18 }, ]
  • src/index.ts:516-518 (registration)
    Registration of all tools including calculate_labor_cost via the ListToolsRequestSchema handler, which returns the complete tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { 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/wspotter/mcpart'

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