get_credits
Retrieve your current workspace credit balance to track usage and plan AI content creation.
Instructions
Get workspace credit balance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server/index.js:762-771 (registration)Registration of the 'get_credits' tool via server.tool().
server.tool( "get_credits", "Get workspace credit balance.", {}, { title: "Get Workspace Credits", readOnlyHint: true, destructiveHint: false, openWorldHint: false }, async () => { const data = await apiCall("/v1/ai/credits", "GET"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } ); - server/index.js:767-770 (handler)Handler function for 'get_credits' - calls GET /v1/ai/credits API and returns the balance.
async () => { const data = await apiCall("/v1/ai/credits", "GET"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } - server/index.js:765-765 (schema)Schema for 'get_credits' - empty object (no input parameters).
{}, - server/index.js:112-123 (helper)Helper function apiCall() used by the handler to make authenticated HTTP requests.
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(); }