get_client_info
Retrieve client information, account details, and jar data from Monobank using an API token with appropriate permissions.
Instructions
Get client information from Monobank API. This tool retrieves information about the client, their accounts, and jars. It requires a Monobank API token with the necessary permissions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:89-125 (handler)The handler function `getClientInfo()` that executes the tool logic: fetches client info from Monobank API using the token from env, formats as JSON text content.async function getClientInfo() { /** * Get client information from Monobank API. * * This tool retrieves information about the client, their accounts, and jars. * It requires a Monobank API token with the necessary permissions. */ try { const token = process.env.MONOBANK_API_TOKEN; const response = await fetch(`https://api.monobank.ua/personal/client-info`, { headers: { "X-Token": token || "X_TOKEN_PLACEHOLDER", }, }); if (!response.ok) { const errorText = await response.text(); throw new Error(`HTTP error! status: ${response.status}, body: ${errorText}`); } const data: ClientInfo = await response.json() as ClientInfo; return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; } catch (error) { if (error instanceof Error) { throw new Error(`Failed to connect to Monobank API: ${error.message}`); } throw new Error(`Failed to connect to Monobank API: ${String(error)}`); } }
- src/index.ts:218-226 (registration)Tool registration in the `ListToolsRequestSchema` handler: defines name, description, and empty input schema (no parameters required).{ name: "get_client_info", description: "Get client information from Monobank API. This tool retrieves information about the client, their accounts, and jars. It requires a Monobank API token with the necessary permissions.", inputSchema: { type: "object", properties: {}, required: [], }, },
- src/index.ts:254-255 (registration)Dispatch/registration in the `CallToolRequestSchema` switch: maps tool name to the handler function.case "get_client_info": return await getClientInfo();
- src/index.ts:36-42 (schema)TypeScript interface defining the structure of the ClientInfo response from the API.clientId: string; name: string; webHookUrl: string; permissions: string; accounts: Account[]; jars?: Jar[]; }