Get Score Badge
get_badgeGenerate embeddable SVG badges that display Ethereum wallet reputation scores. Returns badge URLs and raw SVG code for integration into websites, documentation, or applications to visualize trust metrics.
Instructions
Get the embeddable SVG badge URL for a wallet's reputation score.
Returns the badge endpoint URL and the raw SVG content. The URL can be embedded in markdown, HTML, or any context that supports images.
This is a FREE endpoint.
Args:
wallet (string): Ethereum wallet address
Returns: { badgeUrl, svg }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallet | Yes | Ethereum wallet address (e.g. 0xAbC...123) |
Implementation Reference
- src/tools.ts:284-294 (handler)The handler function that executes the get_badge tool logic. It constructs the badge URL, makes an API request to fetch the SVG content, and returns the badgeUrl and svg in a JSON response.
async ({ wallet }) => { try { const badgeUrl = `${(await import("./client.js")).getConfig().baseUrl}/v1/badge/${wallet}.svg`; const svg = await apiRequest<string>({ path: `/v1/badge/${wallet}.svg`, }); return ok(JSON.stringify({ badgeUrl, svg }, null, 2)); } catch (error) { return err(error); } } - src/tools.ts:259-295 (registration)The registration of the 'get_badge' tool with the MCP server. Includes title, description, inputSchema with WalletSchema, and MCP annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint).
// 6. get_badge ────────────────────────────────────────────────────── server.registerTool( "get_badge", { title: "Get Score Badge", description: `Get the embeddable SVG badge URL for a wallet's reputation score. Returns the badge endpoint URL and the raw SVG content. The URL can be embedded in markdown, HTML, or any context that supports images. This is a FREE endpoint. Args: - wallet (string): Ethereum wallet address Returns: { badgeUrl, svg }`, inputSchema: { wallet: WalletSchema }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }, async ({ wallet }) => { try { const badgeUrl = `${(await import("./client.js")).getConfig().baseUrl}/v1/badge/${wallet}.svg`; const svg = await apiRequest<string>({ path: `/v1/badge/${wallet}.svg`, }); return ok(JSON.stringify({ badgeUrl, svg }, null, 2)); } catch (error) { return err(error); } } ); - src/tools.ts:24-27 (schema)The WalletSchema used for input validation in get_badge and other tools. Validates that the wallet is a valid Ethereum address format (0x + 40 hex characters).
const WalletSchema = z .string() .regex(/^0x[a-fA-F0-9]{40}$/, "Must be a valid Ethereum address (0x + 40 hex chars)") .describe("Ethereum wallet address (e.g. 0xAbC...123)"); - src/tools.ts:31-37 (helper)Helper functions used by the get_badge handler. ok() formats successful responses, err() formats error responses with proper MCP error structure.
function ok(text: string) { return { content: [{ type: "text" as const, text }] }; } function err(error: unknown) { return { isError: true as const, content: [{ type: "text" as const, text: formatError(error) }] }; }