Skip to main content
Glama

read.asset.prices

Read-onlyIdempotent

Fetch current USD prices for single or multiple asset addresses. Pass addresses as comma-separated string to get a price map keyed by each address.

Instructions

Get USD prices for one or more asset addresses. Pass a single address or comma-separated addresses. Returns a price map keyed by address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
asset_addressesYesSingle address or comma-separated addresses for price lookup
chain_idNoChain ID: 8453 (Base), 130 (Unichain), or 10 (Optimism)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
pricesYes

Implementation Reference

  • The core handler function for the 'read.asset.prices' tool. Splits the comma-separated asset_addresses input, calls api.getPrice (single) or api.getPrices (multi), wraps the result into a {prices: {...}} structure, and returns it as text and structured content. On error, returns an isError response.
    server.registerTool(
      "read.asset.prices",
      {
        annotations: {
          title: "Get Asset Prices",
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: true,
        },
        description:
          "Get USD prices for one or more asset addresses. Pass a single address or comma-separated addresses. Returns a price map keyed by address.",
        inputSchema: {
          asset_addresses: z
            .string()
            .describe("Single address or comma-separated addresses for price lookup"),
          chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
        },
        outputSchema: AssetPricesOutput,
      },
      async ({ asset_addresses, chain_id }) => {
        try {
          const addresses = asset_addresses.split(",").map((a) => a.trim());
          const result =
            addresses.length === 1
              ? await api.getPrice(chain_id, addresses[0])
              : await api.getPrices(chain_id, addresses);
          const wrapped =
            typeof result === "number"
              ? { prices: { [addresses[0]]: result } }
              : { prices: result as Record<string, number> };
          return {
            content: [{ type: "text" as const, text: JSON.stringify(wrapped, null, 2) }],
            structuredContent: wrapped,
          };
        } catch (err) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error: ${err instanceof Error ? err.message : String(err)}`,
              },
            ],
            isError: true,
          };
        }
      },
    );
  • Output schema for the tool: AssetPricesOutput is a Zod object with a single field 'prices' which is a Record<string, number> mapping asset addresses to their USD prices.
    export const AssetPricesOutput = z.object({
      prices: z.record(z.number()),
    });
  • Tool registration metadata for 'read.asset.prices' including annotations (title: 'Get Asset Prices', readOnlyHint, idempotentHint), description, input schema (asset_addresses: string, chain_id: number with default 8453), and output schema (AssetPricesOutput).
    server.registerTool(
      "read.asset.prices",
      {
        annotations: {
          title: "Get Asset Prices",
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: true,
        },
        description:
          "Get USD prices for one or more asset addresses. Pass a single address or comma-separated addresses. Returns a price map keyed by address.",
        inputSchema: {
          asset_addresses: z
            .string()
            .describe("Single address or comma-separated addresses for price lookup"),
          chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
        },
        outputSchema: AssetPricesOutput,
      },
  • API client method getPrice() - fetches a single asset price via GET /assets/price with chain_id and asset params.
    async getPrice(chainId: number, asset: string) {
      return this.get("/assets/price", { chain_id: chainId, asset });
    }
  • API client method getPrices() - fetches multiple asset prices via GET /assets/prices with chain_id and multiple 'assets' query params. Returns a Record<string, number> mapping addresses to USD prices.
    async getPrices(chainId: number, assets: string[]) {
      const url = new URL(`${this.baseUrl}${API_PREFIX}/assets/prices`);
      url.searchParams.set("chain_id", String(chainId));
      for (const a of assets) {
        url.searchParams.append("assets", a);
      }
      const resp = await fetch(url.toString(), {
        headers: DEFAULT_HEADERS,
        signal: AbortSignal.timeout(this.timeout),
      });
      if (!resp.ok) await this.throwApiError(resp, "/assets/prices");
      return resp.json() as Promise<Record<string, number>>;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=true, indicating a safe, idempotent read operation. The description adds the return format (price map keyed by address) but no additional behavioral traits like rate limits or auth requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence followed by a usage clarification. It is front-loaded, concise, and every word adds value. No unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple purpose, rich annotations, fully described parameters in schema, and presence of an output schema (not shown but signaled), the description sufficiently explains functionality, input format, and return structure for correct agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with descriptions for both parameters. The description does not add any new meaning beyond what the schema provides. Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The name 'read.asset.prices' and title 'Get Asset Prices' clearly indicate the action and resource. The description states 'Get USD prices for one or more asset addresses' with specific verb and resource, distinguishing it from sibling tools like 'read.asset.list' or 'read.wallet.balances'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description instructs how to pass addresses ('single or comma-separated'), implying usage for price lookups. However, it lacks explicit guidance on when to use vs. alternatives or when not to use it (e.g., for historical prices). The context from sibling tools partially fills this gap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/arcadia-finance/mcp-server'

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