zetrix_get_account_metadata
Retrieve metadata associated with a Zetrix blockchain account address, optionally filtering by specific key to access account information stored on-chain.
Instructions
Get metadata associated with an account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | The Zetrix account address | |
| key | No | Specific metadata key (optional) |
Implementation Reference
- src/zetrix-client.ts:388-419 (handler)Core handler function that queries the Zetrix RPC API /getAccountMetaData endpoint to retrieve account metadata, handling optional specific key and error cases.async getAccountMetadata( address: string, key?: string ): Promise<ZetrixAccountMetadata[]> { try { const params: any = { address }; if (key) { params.key = key; } const response = await this.client.get("/getAccountMetaData", { params }); if (response.data.error_code !== 0) { throw new Error( response.data.error_desc || `API Error: ${response.data.error_code}` ); } // If a specific key is requested, the result is keyed by that key name // Otherwise it returns metadatas array const result = response.data.result; if (key && result[key]) { return [result[key]]; } return result.metadatas || []; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Failed to get account metadata: ${error.message}`); } throw error; } }
- src/index.ts:907-923 (handler)MCP server handler case that extracts arguments and calls the ZetrixClient.getAccountMetadata method, formatting response as MCP content.case "zetrix_get_account_metadata": { if (!args) { throw new Error("Missing arguments"); } const result = await zetrixClient.getAccountMetadata( args.address as string, args.key as string | undefined ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:180-193 (schema)Input schema definition for the tool, specifying required address and optional key parameters.inputSchema: { type: "object", properties: { address: { type: "string", description: "The Zetrix account address", }, key: { type: "string", description: "Specific metadata key (optional)", }, }, required: ["address"], },
- src/index.ts:177-194 (registration)Tool registration in the tools array used by MCP server.setRequestHandler(ListToolsRequestSchema).{ name: "zetrix_get_account_metadata", description: "Get metadata associated with an account", inputSchema: { type: "object", properties: { address: { type: "string", description: "The Zetrix account address", }, key: { type: "string", description: "Specific metadata key (optional)", }, }, required: ["address"], }, },
- src/zetrix-client.ts:77-82 (schema)TypeScript interface defining the structure of account metadata returned by the handler.export interface ZetrixAccountMetadata { key: string; value: string; version: number; }