get_absences
Retrieve employee absence records to track time off, sick leave, and other work absences from the Simplicate business management system.
Instructions
Retrieve employee absences
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No |
Input Schema (JSON Schema)
{
"properties": {
"limit": {
"type": "number"
},
"offset": {
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- The core handler logic for fetching absences from the Simplicate HRM API endpoint '/hrm/absence'. This is the implementation executed when the 'get_absences' tool is called via dynamic dispatching in http-mcp-server.async getAbsences(params?: { limit?: number; offset?: number }): Promise<SimplicateAbsence[]> { const response = await this.client.get('/hrm/absence', params); return response.data || []; }
- Type definition/schema for the absence objects returned by getAbsencesexport interface SimplicateAbsence { id: string; employee?: { id: string; name: string }; absence_type: string; start_date: string; end_date: string; }
- src/http-mcp-server.ts:25-54 (helper)Dynamic tool dispatcher that maps 'get_absences' tool name to 'getAbsences' service method via toMethodName conversion and executes it using SimplicateServiceExtended instance.async function dispatchTool(toolName: string, args: any) { const method = toMethodName(toolName); // heuristic param extraction const params: any[] = []; if (args && typeof args === 'object') { // common id patterns const idKeys = ['project_id','organization_id','person_id','task_id','service_id','invoice_id','id']; let foundId = false; for (const k of idKeys) { if (k in args) { params.push(args[k]); foundId = true; break; } } if (args.data) params.push(args.data); if (!foundId && params.length === 0) params.push(args); } else if (args !== undefined) { params.push(args); } // @ts-ignore - dynamic call if (typeof (service as any)[method] === 'function') { // call and return // Some methods expect a single primitive id; spread params return await (service as any)[method](...params); } throw new Error(`Unknown tool/method: ${toolName} -> ${method}`); }
- src/http-mcp-server.ts:20-23 (helper)Utility function that converts MCP tool names like 'get_absences' to service method names like 'getAbsences'.function toMethodName(toolName: string) { // convert snake_case to camelCase: get_projects -> getProjects return toolName.split('_').map((p, i) => i === 0 ? p : p[0].toUpperCase() + p.slice(1)).join(''); }