Skip to main content
Glama

get_mileage

Retrieve mileage records from Simplicate business data to track and manage travel expenses for projects and clients.

Instructions

Retrieve mileage records

Input Schema

NameRequiredDescriptionDefault
limitNo
offsetNo

Input Schema (JSON Schema)

{ "properties": { "limit": { "type": "number" }, "offset": { "type": "number" } }, "type": "object" }

Implementation Reference

  • The getMileage method retrieves mileage data from the Simplicate API endpoint '/costs/mileage'. It handles optional pagination parameters and gracefully returns an empty array on error.
    async getMileage(params?: { limit?: number; offset?: number }): Promise<SimplicateMileage[]> { try { const response = await this.client.get('/costs/mileage', params); return response.data || []; } catch (error) { // Mileage endpoint may require specific filters console.warn('getMileage: endpoint returned error, returning empty array'); return []; }
  • TypeScript interface defining the structure of SimplicateMileage objects returned by getMileage.
    export interface SimplicateMileage { id: string; employee?: { id: string; name: string }; project?: { id: string; name: string }; distance: number; date: string; rate: number; }
  • Dynamic tool handler in HTTP MCP server that converts snake_case tool names like 'get_mileage' to camelCase method 'getMileage' on SimplicateServiceExtended and executes it with parsed arguments.
    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}`); }

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/daanno/simplicate-mcp'

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