Skip to main content
Glama
stampchain-io

Stampchain MCP Server

Official

get_market_data

Retrieve market data for Bitcoin Stamps with trading activity indicators, floor price filters, and volume data to analyze market trends.

Instructions

Retrieve market data for stamps with trading activity indicators (v2.3 feature)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stamp_idNoFilter by specific stamp ID
activity_levelNoFilter by trading activity level
min_floor_priceNoMinimum floor price in BTC
max_floor_priceNoMaximum floor price in BTC
include_volume_dataNoInclude volume data in response
pageNoPage number
page_sizeNoItems per page

Implementation Reference

  • The execute method of GetMarketDataTool class implements the core tool logic: validates parameters, checks API feature availability, fetches market data via StampchainClient.getMarketData(), formats the response as text, and handles errors.
    public async execute(params: GetMarketDataParams, context?: ToolContext): Promise<ToolResponse> {
      try {
        context?.logger?.info('Executing get_market_data tool', { params });
    
        // Validate parameters
        const validatedParams = this.validateParams(params);
    
        // Use API client from context if available, otherwise use instance client
        const client = context?.apiClient || this.apiClient;
    
        // Check if v2.3 features are available
        const features = client.getFeatureAvailability();
        if (!features.marketData) {
          return textResponse(
            'Market data is not available in the current API version. Please upgrade to v2.3 or later.'
          );
        }
    
        // Get market data
        const marketData = await client.getMarketData(validatedParams);
    
        if (!marketData.data || marketData.data.length === 0) {
          return textResponse('No market data found for the specified criteria');
        }
    
        // Format the response
        const lines = [`Market Data (${marketData.data.length} results):`];
        lines.push('---');
    
        marketData.data.forEach((data: StampMarketData, index: number) => {
          lines.push(`${index + 1}. Market Data Entry`);
          lines.push(`   Floor Price: ${data.floorPriceBTC || 'N/A'} BTC`);
          if (data.floorPriceUSD) {
            lines.push(`   Floor Price USD: $${data.floorPriceUSD.toFixed(2)}`);
          }
          // Note: marketCapUSD not available in v2.3 marketData object
          lines.push(`   Activity Level: ${data.activityLevel}`);
          if (data.lastActivityTime) {
            lines.push(`   Last Activity: ${new Date(data.lastActivityTime * 1000).toISOString()}`);
          }
          if (data.volume24hBTC) {
            lines.push(`   24h Volume: ${data.volume24hBTC} BTC`);
          }
          if (data.lastSaleTxHash) {
            lines.push(`   Last Sale TX: ${data.lastSaleTxHash}`);
          }
          if (data.lastSaleBuyerAddress) {
            lines.push(`   Last Buyer: ${data.lastSaleBuyerAddress}`);
          }
          lines.push('');
        });
    
        // Add metadata
        lines.push('Metadata:');
        lines.push(`- Total Results: ${marketData.total}`);
        lines.push(`- Page: ${marketData.page}`);
        lines.push(`- Page Size: ${marketData.limit}`);
        lines.push(`- Last Block: ${marketData.last_block}`);
    
        return textResponse(lines.join('\n'));
      } catch (error) {
        context?.logger?.error('Error executing get_market_data tool', { error });
    
        if (error instanceof ValidationError) {
          throw error;
        }
    
        if (error instanceof ToolExecutionError) {
          throw error;
        }
    
        // Pass through the original error message for API errors
        if (error instanceof Error) {
          throw new ToolExecutionError(error.message, this.name, error);
        }
    
        throw new ToolExecutionError('Failed to retrieve market data', this.name, error);
      }
  • Zod schema GetMarketDataParamsSchema defining input validation and TypeScript types for the get_market_data tool parameters.
    export const GetMarketDataParamsSchema = z.object({
      stamp_id: z.number().int().positive().optional(),
      activity_level: z.enum(['HOT', 'WARM', 'COOL', 'DORMANT', 'COLD']).optional(),
      min_floor_price: z.number().positive().optional(),
      max_floor_price: z.number().positive().optional(),
      include_volume_data: z.boolean().optional().default(true),
      page: z.number().int().min(1).optional().default(1),
      page_size: z.number().int().min(1).max(100).optional().default(20),
    });
    
    export type GetMarketDataParams = z.infer<typeof GetMarketDataParamsSchema>;
  • Registration of GetMarketDataTool in the stampTools export object, making it available for tool aggregation and server registration.
    export const stampTools = {
      get_stamp: GetStampTool,
      search_stamps: SearchStampsTool,
      get_recent_stamps: GetRecentStampsTool,
      get_recent_sales: GetRecentSalesTool,
      get_market_data: GetMarketDataTool,
      get_stamp_market_data: GetStampMarketDataTool,
    };
  • Central list of all available tool names including 'get_market_data' for MCP tool discovery.
    export function getAvailableToolNames(): string[] {
      return [
        // Stamp tools
        'get_stamp',
        'search_stamps',
        'get_recent_stamps',
        'get_recent_sales',
        'get_market_data',
        'get_stamp_market_data',
    
        // Collection tools
        'get_collection',
        'search_collections',
    
        // Token tools
        'get_token_info',
        'search_tokens',
    
        // Analysis tools
        'analyze_stamp_code',
        'get_stamp_dependencies',
        'analyze_stamp_patterns',
      ];
    }
  • StampchainClient.getMarketData method that performs the HTTP request to the Stampchain API endpoint for market data, used by the tool handler.
    async getMarketData(params: MarketDataQueryParams = {}): Promise<{
      data: StampMarketData[];
      last_block: number;
      page: number;
      limit: number;
      total: number;
    }> {
      const response = await this.client.get('/stamps/marketData', { params });
      return response.data;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'trading activity indicators' but doesn't explain what these are, how data is retrieved (e.g., real-time vs. cached), rate limits, authentication needs, or error handling. For a data retrieval tool with no annotation coverage, this is insufficient to inform the agent about operational behavior.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the core purpose. It avoids redundancy and wastes no words, though it could be slightly more structured by separating version info or adding brief context. Overall, it's appropriately sized for its content.

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

Completeness2/5

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

Given the complexity of a market data tool with 7 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on return values (e.g., data format, included fields), behavioral traits (e.g., pagination behavior, data freshness), and differentiation from siblings. This leaves significant gaps for the agent to understand the tool's full context.

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 has 100% description coverage, providing clear details for all 7 parameters (e.g., filters, pagination). The description adds no additional parameter semantics beyond implying 'trading activity indicators' might relate to the 'activity_level' enum. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't detract either.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Retrieve market data for stamps with trading activity indicators'. It specifies the resource (market data for stamps) and includes a version reference (v2.3 feature). However, it doesn't explicitly differentiate from sibling tools like 'get_stamp_market_data' or 'get_recent_sales', which reduces clarity about when to choose this specific tool.

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 no guidance on when to use this tool versus alternatives. With multiple sibling tools related to stamps and market data (e.g., get_stamp_market_data, get_recent_sales, search_stamps), there is no indication of context, prerequisites, or comparisons. This leaves the agent without direction for tool selection.

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/stampchain-io/stampchain-mcp'

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