Pepesto Credits (check balance)
pepesto_creditsCheck the remaining API credits on your Pepesto API key to monitor usage and avoid interruptions.
Instructions
Return the remaining API credits on the configured Pepesto API key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/credits.ts:14-15 (handler)The handler function that executes the pepesto_credits tool logic – makes a POST request to the /credits endpoint via the PepestoClient and wraps the result through the runTool helper.
async () => runTool(() => client.post("/credits", {})), ); - src/tools/credits.ts:12-12 (schema)The input schema for pepesto_credits is an empty object (no parameters required).
inputSchema: {}, - src/tools/credits.ts:5-16 (registration)Registration function that calls server.registerTool with the name 'pepesto_credits', metadata (title, description, inputSchema), and the handler.
export function registerCreditsTool(server: McpServer, client: PepestoClient): void { server.registerTool( "pepesto_credits", { title: "Pepesto Credits (check balance)", description: "Return the remaining API credits on the configured Pepesto API key.", inputSchema: {}, }, async () => runTool(() => client.post("/credits", {})), ); } - src/tools/_runner.ts:9-27 (helper)The runTool helper used by the handler to execute the API call, format success results as JSON text, and wrap errors into a ToolResult with isError flag.
export async function runTool(fn: () => Promise<unknown>): Promise<ToolResult> { try { const result = await fn(); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } catch (err) { const msg = err instanceof PepestoApiError ? err.message : err instanceof Error ? `Error: ${err.message}` : `Error: ${String(err)}`; return { content: [{ type: "text", text: msg }], isError: true, }; } }