Get Credits
get_creditsView remaining credits on your GhostMinutes API key to track usage and plan transcriptions.
Instructions
Show remaining GhostMinutes credits for the authenticated API key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/get-credits.ts:15-34 (handler)The register function that registers the 'get_credits' tool with the MCP server. The handler calls requireAuth, then client.getCredits(), and returns the response as JSON text with structured content.
export function register(server: McpServer, client: GhostMinutesClient): void { server.registerTool( 'get_credits', { title: 'Get Credits', description: 'Show remaining GhostMinutes credits for the authenticated API key.', inputSchema: z.object({}), annotations: { readOnlyHint: true, openWorldHint: false }, }, async () => { requireAuth(client); const body = await client.getCredits(); return { content: [{ type: 'text', text: JSON.stringify(body, null, 2) }], structuredContent: jsonStructured(body), }; }, ); } - src/tools/get-credits.ts:16-23 (registration)Registration of the 'get_credits' tool via server.registerTool, with schema, title, description, and annotations.
server.registerTool( 'get_credits', { title: 'Get Credits', description: 'Show remaining GhostMinutes credits for the authenticated API key.', inputSchema: z.object({}), annotations: { readOnlyHint: true, openWorldHint: false }, - src/tools/get-credits.ts:22-22 (schema)Input schema defined as z.object({}) — no parameters required.
inputSchema: z.object({}), - src/client.ts:162-171 (helper)The getCredits() method on GhostMinutesClient that makes an HTTP GET request to '/mcp/me' with the API key bearer token.
async getCredits(): Promise<unknown> { try { const res = await this.http.get('/mcp/me', { headers: { Authorization: `Bearer ${this.apiKey}` }, }); return this.ensureOk(res); } catch (e) { this.handleThrown(e); } } - src/server.ts:5-5 (registration)Import of the register function from get-credits.ts.
import { register as registerGetCredits } from './tools/get-credits.js'; - src/server.ts:39-39 (registration)Invocation of registerGetCredits(server, client) in the server setup.
registerGetCredits(server, client);