Get Client Credits
get_client_creditsRetrieve the current credit balance for a specified client by providing their client ID.
Instructions
Get client credit balance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client_id | Yes | The client ID |
Implementation Reference
- server/index.js:1100-1105 (handler)The handler function for get_client_credits tool. Makes a GET request to /v1/ai/credits/client?client_id=<id> and returns the credit balance data.
async ({ client_id }) => { const data = await apiCall(`/v1/ai/credits/client?client_id=${client_id}`, "GET"); const payload = data?.result || data; return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] }; } ); - server/index.js:1090-1105 (registration)Registration of the get_client_credits tool via server.registerTool with name 'get_client_credits', input schema requiring client_id as a string, and read-only annotation.
server.registerTool( "get_client_credits", { title: "Get Client Credits", description: "Get client credit balance.", inputSchema: { client_id: z.string().describe("The client ID"), }, annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false }, }, async ({ client_id }) => { const data = await apiCall(`/v1/ai/credits/client?client_id=${client_id}`, "GET"); const payload = data?.result || data; return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] }; } ); - server/index.js:1095-1096 (schema)Input schema for get_client_credits requiring a single parameter 'client_id' (string) described as 'The client ID'.
inputSchema: { client_id: z.string().describe("The client ID"), - server/index.js:112-123 (helper)Helper function apiCall used by the handler to make authenticated HTTP requests to the Lindo AI API.
async function apiCall(path, method, body) { const url = `${BASE_URL}${path}`; const res = await fetch(url, { method, headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json", }, ...(body ? { body: JSON.stringify(body) } : {}), }); return res.json(); }