get_client_info
Retrieve client information, account details, and jar data from Monobank using API authentication.
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 main handler function that implements the 'get_client_info' tool. It fetches client information from the Monobank API using an API token from environment variables and returns the data as a formatted JSON string in the expected MCP tool response format.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 ListTools response, defining the name, description, and 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:35-42 (schema)TypeScript interface defining the structure of the ClientInfo response from the API, used for type-checking the API response in the handler.interface ClientInfo { clientId: string; name: string; webHookUrl: string; permissions: string; accounts: Account[]; jars?: Jar[]; }
- src/index.ts:254-255 (registration)Dispatch registration in the CallToolRequest handler switch statement, mapping the tool name to the handler function.case "get_client_info": return await getClientInfo();