Skip to main content
Glama

get_user

Retrieve detailed information about the current Recraft API user, including email, name, and credit balance, for seamless integration and account management.

Instructions

Get information about the current Recraft API user (their email, name, and credit balance).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_user' tool. It retrieves the current user's information (email, name, credits) via the Recraft API and returns a formatted text response, including a warning if credits are low.
    export const getUserHandler = async (server: RecraftServer, _args: Record<string, unknown>): Promise<CallToolResult> => { try { const result = await server.api.userApi.getCurrentUser() return { content: [ { type: 'text', text: `User email: ${result.email}, name: ${result.name}.\nYou have ${result.credits} credits left.` + ( result.credits >= ALMOST_ZERO_CREDITS ? "" : `\nYou are ${result.credits > 0 ? "almost" : ""} out of credits. Please top up your account on https://www.recraft.ai/profile/api.` ) }, ] } } catch (error) { return { content: [ { type: 'text', text: `Get user error: ${error}` } ], isError: true } } }
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    export const getUserTool = { name: "get_user", description: "Get information about the current Recraft API user (their email, name, and credit balance).", inputSchema: { type: "object", properties: { }, required: [] } }
  • src/index.ts:68-82 (registration)
    Registration of the getUserTool in the list of available tools returned by ListToolsRequestHandler.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ generateImageTool, createStyleTool, vectorizeImageTool, imageToImageTool, removeBackgroundTool, replaceBackgroundTool, crispUpscaleTool, creativeUpscaleTool, getUserTool, ], } })
  • src/index.ts:118-119 (registration)
    Dispatch/registration of the getUserHandler in the switch statement for CallToolRequestHandler.
    case getUserTool.name: return await getUserHandler(recraftServer, args ?? {})
  • src/index.ts:20-20 (registration)
    Import of getUserTool and getUserHandler from the implementation file.
    import { getUserHandler, getUserTool } from "./tools/GetUser"

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/recraft-ai/mcp-recraft-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server