Skip to main content
Glama
jun229

truemarkets-mcp-server

by jun229

Get token price

tm_get_price
Read-onlyIdempotent

Retrieve current token prices in USDC using zero-cost quotes. Automatically resolves token symbols to addresses without requiring API keys.

Instructions

Get the current price of a token in USDC by running a zero-cost quote.

Resolves token symbols (SOL, ETH) to addresses automatically. Does NOT require an API key — only auth token.

Args:

  • token (string): Token symbol (e.g. "SOL") or contract address

  • chain (string): "solana" or "base" (default: "solana")

Returns: { token, chain, price_usdc, qty_in, qty_out }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesToken symbol (SOL, ETH) or contract address
chainNoBlockchain networksolana

Implementation Reference

  • The handler function for the `tm_get_price` tool which resolves token symbols and fetches a quote from the API to calculate the price.
    async ({ token, chain }) => {
      // Resolve symbol to address if needed
      let baseAsset = token;
      let resolvedChain = chain;
    
      if (isSymbol(token)) {
        const assets = await api.getAssets();
        const match = assets.find(
          (a) => a.symbol?.toLowerCase() === token.toLowerCase()
        );
        if (!match?.address) {
          return {
            isError: true,
            content: [{ type: "text", text: `Could not resolve symbol "${token}". Use tm_list_assets to see available tokens.` }],
          };
        }
        baseAsset = match.address;
        if (match.chain) resolvedChain = match.chain.toLowerCase() as "solana" | "base";
      }
    
      const quote = await api.createQuote({
        order_side: "buy",
        chain: resolvedChain,
        base_asset: baseAsset,
        quote_asset: getQuoteAsset(resolvedChain),
        qty: "1",
      });
    
      const price = parseFloat(quote.qty) / parseFloat(quote.qty_out);
    
      const output = {
        token: token.toUpperCase(),
        chain: resolvedChain,
        price_usdc: price.toFixed(6),
        qty_in: quote.qty,
        qty_out: quote.qty_out,
        fee: quote.fee,
      };
    
      return {
        content: [{ type: "text", text: JSON.stringify(output, null, 2) }],
        structuredContent: output,
      };
    }
  • The schema definition and registration parameters for `tm_get_price`.
        {
          title: "Get token price",
          description: `Get the current price of a token in USDC by running a zero-cost quote.
    
    Resolves token symbols (SOL, ETH) to addresses automatically.
    Does NOT require an API key — only auth token.
    
    Args:
      - token (string): Token symbol (e.g. "SOL") or contract address
      - chain (string): "solana" or "base" (default: "solana")
    
    Returns: { token, chain, price_usdc, qty_in, qty_out }`,
          inputSchema: {
            token: z.string().describe("Token symbol (SOL, ETH) or contract address"),
            chain: z.enum(["solana", "base"]).default("solana").describe("Blockchain network"),
          },
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: true,
          },
        },
Behavior4/5

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

Annotations cover read-only, open-world, idempotent, and non-destructive traits. The description adds valuable context beyond this: it specifies 'zero-cost quote' (implying no fees), 'Resolves token symbols automatically' (behavioral detail), and 'Does NOT require an API key — only auth token' (auth needs). This enriches understanding without contradicting annotations.

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 front-loaded with the core purpose, followed by key behavioral details and a clear Args/Returns structure. Every sentence adds value (e.g., symbol resolution, auth info), with no wasted words, making it efficient and well-organized.

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 tool's low complexity (2 parameters, no output schema), rich annotations, and 100% schema coverage, the description is complete. It covers purpose, usage context, behavioral traits, and return format, providing all necessary information for an agent to invoke it correctly without redundancy.

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 description coverage is 100%, so the schema already documents parameters fully. The description adds minimal semantics: it reiterates token symbol examples and chain options, but does not provide additional meaning (e.g., format details or edge cases). Baseline 3 is appropriate as the schema carries the burden.

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 description clearly states the specific action ('Get the current price') and resource ('token in USDC'), distinguishing it from siblings like tm_execute_trade (trading) or tm_get_balances (balance checking). It specifies the method ('by running a zero-cost quote'), making the purpose unambiguous and distinct.

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 provides clear context on when to use this tool: for price queries with automatic symbol resolution and no API key requirement. However, it does not explicitly mention when not to use it or name alternatives (e.g., tm_get_quote might be similar), leaving some ambiguity in sibling differentiation.

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/jun229/tm-mcp-server'

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