get-balance
Check account balances on the Payman AI MCP Server using natural language prompts. Simplify financial tracking and manage your payments efficiently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- payman-server.ts:567-636 (handler)The handler function for the 'get-balance' tool. It fetches the current balance in TSD currency from the Payman API using the provided API key, handles authentication errors, HTTP errors, and network issues, returning formatted text content or error messages.server.tool("get-balance", {}, async () => { if (!paymanApiKey) { return { content: [ { type: "text", text: "API key has not been set. Please use the set-api-key tool first.", }, ], isError: true, }; } try { const response = await fetch( "https://agent.payman.ai/api/balances/currencies/TSD", { method: "GET", headers: { "x-payman-api-secret": paymanApiKey, "content-type": "application/json", }, } ); // Handle the response if (!response.ok) { let errorData; try { errorData = await response.json(); } catch (e) { errorData = await response.text(); } return { content: [ { type: "text", text: `Error fetching balance (Status ${ response.status }): ${JSON.stringify(errorData)}`, }, ], isError: true, }; } const data = await response.json(); return { content: [ { type: "text", text: `Current Balance: ${data}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to get balance: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } });
- payman-server.ts:567-567 (registration)Registration of the 'get-balance' tool with empty input schema on the MCP server.server.tool("get-balance", {}, async () => {
- payman-server.ts:567-567 (schema)Empty input schema for the 'get-balance' tool, indicating no input parameters are required.server.tool("get-balance", {}, async () => {