zetrix_get_account_assets
Retrieve asset holdings for a Zetrix blockchain account. Specify an address to view all assets, or add optional asset code and issuer parameters to filter results.
Instructions
Get asset holdings for an account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | The Zetrix account address | |
| code | No | Asset code (optional, must be used with issuer) | |
| issuer | No | Asset issuer address (optional, must be used with code) |
Implementation Reference
- src/zetrix-client.ts:359-386 (handler)Core handler function in ZetrixClient that executes the API call to retrieve account assets from the Zetrix node.
async getAccountAssets( address: string, code?: string, issuer?: string ): Promise<ZetrixAccountAsset[]> { try { const params: any = { address }; if (code && issuer) { params.code = code; params.issuer = issuer; } const response = await this.client.get("/getAccountAssets", { params }); if (response.data.error_code !== 0) { throw new Error( response.data.error_desc || `API Error: ${response.data.error_code}` ); } return response.data.result.assets || []; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Failed to get account assets: ${error.message}`); } throw error; } } - src/index.ts:155-176 (registration)Tool registration in the tools array, including name, description, and input schema.
{ name: "zetrix_get_account_assets", description: "Get asset holdings for an account", inputSchema: { type: "object", properties: { address: { type: "string", description: "The Zetrix account address", }, code: { type: "string", description: "Asset code (optional, must be used with issuer)", }, issuer: { type: "string", description: "Asset issuer address (optional, must be used with code)", }, }, required: ["address"], }, }, - src/index.ts:888-905 (handler)MCP server request handler switch case that dispatches to ZetrixClient.getAccountAssets and formats the response.
case "zetrix_get_account_assets": { if (!args) { throw new Error("Missing arguments"); } const result = await zetrixClient.getAccountAssets( args.address as string, args.code as string | undefined, args.issuer as string | undefined ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } - src/zetrix-client.ts:69-75 (schema)TypeScript interface defining the structure of account asset objects returned by the tool.
export interface ZetrixAccountAsset { amount: string; key: { code: string; issuer: string; }; }