get_currency
Retrieve a company's currency details using its unique currency ID.
Instructions
Get a company currency by ID. GET /currencies/{currencyId}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| currencyId | Yes | Company currency ID (required) |
Implementation Reference
- Handler function that validates args with Zod schema, then calls currencyService.getCurrency to fetch a company currency by ID.
async function handler(client: Client, args: Record<string, unknown> | undefined) { const parsed = schema.safeParse(args); if (!parsed.success) { return errorResult(parsed.error.errors.map((e) => e.message).join("; ")); } return handleToolCall(() => currencyService.getCurrency(client, parsed.data.currencyId) ); } - Zod validation schema for get_currency tool: requires a non-empty currencyId string.
const schema = z.object({ currencyId: z.string().min(1, "currencyId is required (company currency ID)"), }); - src/tools/currencies/getCurrency.ts:33-36 (registration)Export of the Tool object combining definition and handler for get_currency.
export const getCurrencyTool: Tool = { definition, handler, }; - Service helper: makes a GET /currencies/{currencyId} API call to fetch a company currency by ID.
export async function getCurrency( client: Client, currencyId: string ): Promise<unknown> { return client.get<unknown>(`/currencies/${currencyId}`); }