Skip to main content
Glama
gtorreal
by gtorreal

get_market_volume

Retrieve the 24-hour and 7-day transacted volume for any market on Buda.com, with buys and sells separated. All values are in the base currency.

Instructions

Returns 24h and 7-day transacted volume for a Buda.com market, split by buy (bid) and sell (ask) side. All volume values are floats in the base currency (e.g. BTC for BTC-CLP). Example: 'How much Bitcoin was sold on BTC-CLP in the last 24 hours?'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
market_idYesMarket ID (e.g. 'BTC-CLP', 'ETH-BTC').

Implementation Reference

  • The async handler function for the 'get_market_volume' tool. It validates the market_id, calls the Buda API endpoint /markets/{market_id}/volume, flattens the amount tuples (ask/bid volume for 24h and 7d), and returns the result as JSON.
      async ({ market_id }) => {
        try {
          const validationError = validateMarketId(market_id);
          if (validationError) {
            return {
              content: [{ type: "text", text: JSON.stringify({ error: validationError, code: "INVALID_MARKET_ID" }) }],
              isError: true,
            };
          }
    
          const data = await client.get<VolumeResponse>(
            `/markets/${market_id.toLowerCase()}/volume`,
          );
    
          const v = data.volume;
          const ask24 = flattenAmount(v.ask_volume_24h);
          const ask7d = flattenAmount(v.ask_volume_7d);
          const bid24 = flattenAmount(v.bid_volume_24h);
          const bid7d = flattenAmount(v.bid_volume_7d);
    
          const result = {
            market_id: v.market_id,
            ask_volume_24h: ask24.value,
            ask_volume_24h_currency: ask24.currency,
            ask_volume_7d: ask7d.value,
            ask_volume_7d_currency: ask7d.currency,
            bid_volume_24h: bid24.value,
            bid_volume_24h_currency: bid24.currency,
            bid_volume_7d: bid7d.value,
            bid_volume_7d_currency: bid7d.currency,
          };
    
          return {
            content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
          };
        } catch (err) {
          const msg = formatApiError(err);
          return {
            content: [{ type: "text", text: JSON.stringify(msg) }],
            isError: true,
          };
        }
      },
    );
  • The tool schema definition including name, description, and inputSchema (market_id string parameter).
    export const toolSchema = {
      name: "get_market_volume",
      description:
        "Returns 24h and 7-day transacted volume for a Buda.com market, split by buy (bid) and sell (ask) side. " +
        "All volume values are floats in the base currency (e.g. BTC for BTC-CLP). " +
        "Example: 'How much Bitcoin was sold on BTC-CLP in the last 24 hours?'",
      inputSchema: {
        type: "object" as const,
        properties: {
          market_id: {
            type: "string",
            description: "Market ID (e.g. 'BTC-CLP', 'ETH-BTC').",
          },
        },
        required: ["market_id"],
      },
    };
  • The register() function that registers the tool with the MCP server using server.tool().
    export function register(server: McpServer, client: BudaClient, _cache: MemoryCache): void {
      server.tool(
        toolSchema.name,
        toolSchema.description,
        {
          market_id: z
            .string()
            .describe("Market ID (e.g. 'BTC-CLP', 'ETH-BTC')."),
        },
        async ({ market_id }) => {
          try {
            const validationError = validateMarketId(market_id);
            if (validationError) {
              return {
                content: [{ type: "text", text: JSON.stringify({ error: validationError, code: "INVALID_MARKET_ID" }) }],
                isError: true,
              };
            }
    
            const data = await client.get<VolumeResponse>(
              `/markets/${market_id.toLowerCase()}/volume`,
            );
    
            const v = data.volume;
            const ask24 = flattenAmount(v.ask_volume_24h);
            const ask7d = flattenAmount(v.ask_volume_7d);
            const bid24 = flattenAmount(v.bid_volume_24h);
            const bid7d = flattenAmount(v.bid_volume_7d);
    
            const result = {
              market_id: v.market_id,
              ask_volume_24h: ask24.value,
              ask_volume_24h_currency: ask24.currency,
              ask_volume_7d: ask7d.value,
              ask_volume_7d_currency: ask7d.currency,
              bid_volume_24h: bid24.value,
              bid_volume_24h_currency: bid24.currency,
              bid_volume_7d: bid7d.value,
              bid_volume_7d_currency: bid7d.currency,
            };
    
            return {
              content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
            };
          } catch (err) {
            const msg = formatApiError(err);
            return {
              content: [{ type: "text", text: JSON.stringify(msg) }],
              isError: true,
            };
          }
        },
      );
    }
  • src/index.ts:40-41 (registration)
    The top-level registration call that connects the volume tool to the MCP server via volume.register(server, client, cache).
    volume.register(server, client, cache);
    spread.register(server, client, cache);
  • The flattenAmount helper used in the handler to convert Amount tuples [value_string, currency] into typed {value, currency} objects.
    export function flattenAmount(amount: Amount): { value: number; currency: string } {
      const value = parseFloat(amount[0]);
      if (isNaN(value)) throw new Error(`Invalid amount value: "${amount[0]}"`);
      return { value, currency: amount[1] };
    }
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It describes the output but does not disclose behavioral aspects such as error handling, rate limits, or authentication needs. However, there is no contradiction with the implicit read-only nature.

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 concise with two sentences plus an example, no redundant information, and the key action is front-loaded. Every sentence adds value.

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

Completeness3/5

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

For a simple tool with one parameter and no output schema, the description adequately explains the output format. However, it lacks usage context and behavioral transparency, leaving some gaps for an AI agent to infer.

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?

The input schema already fully describes the parameter 'market_id' (100% coverage). The description adds no additional meaning beyond the schema, so a 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 description clearly states that the tool returns 24h and 7-day transacted volume split by bid/ask side for a Buda.com market. It includes an example and mentions the base currency, making the purpose specific and distinct from sibling tools like get_market_summary or get_ticker.

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

Usage Guidelines2/5

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

The description provides an example query but no explicit guidance on when to use this tool versus alternatives (e.g., get_market_summary, get_orderbook). There is no mention of when-not-to-use or prerequisites.

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/gtorreal/buda-mcp'

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