update_currency
Update a company currency by specifying the conversion rate and fixed rate flag.
Instructions
Update a company currency. PUT /currencies/{companyCurrencyId}. Required: companyCurrencyId, conversionRate, fixedRate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| companyCurrencyId | Yes | Company currency ID (required) | |
| conversionRate | Yes | Conversion rate (required) | |
| fixedRate | Yes | Fixed rate flag (required) |
Implementation Reference
- Handler function for the update_currency tool. Parses arguments with Zod (companyCurrencyId, conversionRate, fixedRate), then calls currencyService.updateCurrency to perform the PUT /currencies/{companyCurrencyId} API request.
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("; ")); } const { companyCurrencyId, conversionRate, fixedRate } = parsed.data; return handleToolCall(() => currencyService.updateCurrency(client, companyCurrencyId, { conversionRate, fixedRate }) ); } - Zod schema (lines 7-11) and MCP inputSchema definition (lines 13-26) for update_currency tool. Requires companyCurrencyId (string), conversionRate (number), fixedRate (boolean).
const schema = z.object({ companyCurrencyId: z.string().min(1, "companyCurrencyId is required"), conversionRate: z.number().finite("conversionRate is required"), fixedRate: z.boolean({ required_error: "fixedRate is required (boolean)" }), }); const definition = { name: "update_currency", description: "Update a company currency. PUT /currencies/{companyCurrencyId}. Required: companyCurrencyId, conversionRate, fixedRate.", inputSchema: { type: "object" as const, properties: { companyCurrencyId: { type: "string", description: "Company currency ID (required)" }, conversionRate: { type: "number", description: "Conversion rate (required)" }, fixedRate: { type: "boolean", description: "Fixed rate flag (required)" }, }, required: ["companyCurrencyId", "conversionRate", "fixedRate"], }, }; - src/tools/currencies/updateCurrency.ts:39-42 (registration)Exports updateCurrencyTool as a Tool object pairing the definition (name/description/inputSchema) with the handler function. This is registered into the tool list via registerCurrencyTools() in the currencies index.
export const updateCurrencyTool: Tool = { definition, handler, }; - The underlying API service function updateCurrency that performs the actual HTTP PUT request to /currencies/{companyCurrencyId} with the provided body (conversionRate, fixedRate).
/** PUT /currencies/{companyCurrencyId} */ export async function updateCurrency( client: Client, companyCurrencyId: string, body: UpdateCurrencyBody ): Promise<unknown> { return client.put<unknown>(`/currencies/${companyCurrencyId}`, body); } - UpdateCurrencyBody interface defining the shape of the request body: conversionRate (number) and fixedRate (boolean).
/** Update body. Aligned with CurrencyService::updateCompanyCurrency: conversionRate, fixedRate required. */ export interface UpdateCurrencyBody {