Skip to main content
Glama
stampchain-io

Stampchain MCP Server

Official

get_stamp

Retrieve detailed information about a specific Bitcoin stamp using its ID, including optional base64 image data for verification and display purposes.

Instructions

Retrieve detailed information about a specific Bitcoin stamp by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stamp_idYesThe ID of the stamp to retrieve
include_base64NoWhether to include base64 image data

Implementation Reference

  • The GetStampTool class implements the core handler logic for the 'get_stamp' MCP tool. It handles input validation, API calls to fetch stamp data, response formatting, and error handling.
    export class GetStampTool extends BaseTool<z.input<typeof GetStampParamsSchema>, GetStampParams> {
      public readonly name = 'get_stamp';
    
      public readonly description =
        'Retrieve detailed information about a specific Bitcoin stamp by its ID';
    
      public readonly inputSchema: MCPTool['inputSchema'] = {
        type: 'object',
        properties: {
          stamp_id: {
            type: ['number', 'string'],
            description: 'The ID of the stamp to retrieve',
          },
          include_base64: {
            type: 'boolean',
            description: 'Whether to include base64 image data',
            default: false,
          },
        },
        required: ['stamp_id'],
      };
    
      public readonly schema = GetStampParamsSchema;
    
      public readonly metadata = {
        version: '1.0.0',
        tags: ['stamps', 'query'],
        requiresNetwork: true,
        apiDependencies: ['stampchain'],
      };
    
      private apiClient: StampchainClient;
    
      constructor(apiClient?: StampchainClient) {
        super();
        this.apiClient = apiClient || new StampchainClient();
      }
    
      public async execute(params: GetStampParams, context?: ToolContext): Promise<ToolResponse> {
        try {
          context?.logger?.info('Executing get_stamp tool', { params });
    
          // Validate parameters
          const validatedParams = this.validateParams(params);
          const stampId = parseStampId(validatedParams.stamp_id);
    
          // Use API client from context if available, otherwise use instance client
          const client = context?.apiClient || this.apiClient;
    
          // Fetch stamp data
          const stamp: Stamp = await client.getStamp(stampId);
    
          if (!stamp) {
            throw new ToolExecutionError(`Stamp with ID ${stampId} not found`, this.name, { stampId });
          }
    
          // Format the response
          const formattedStamp = formatStamp(stamp, {
            includeBase64: validatedParams.include_base64,
          });
    
          // Return both formatted text and JSON data
          return multiResponse({ type: 'text', text: formattedStamp }, stampToJSON(stamp));
        } catch (error) {
          context?.logger?.error('Error executing get_stamp 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 stamp information', this.name, error);
        }
      }
    }
  • Zod schema and TypeScript type for validating input parameters to the get_stamp tool (stamp_id required, include_base64 optional).
    export const GetStampParamsSchema = z.object({
      stamp_id: z
        .union([z.number(), z.string()])
        .refine(
          (val) => {
            const num = typeof val === 'string' ? parseInt(val, 10) : val;
            return !isNaN(num) && num > 0;
          },
          {
            message: 'stamp_id must be a positive number',
          }
        )
        .transform((val) => {
          const num = typeof val === 'string' ? parseInt(val, 10) : val;
          return num;
        }),
      include_base64: z.boolean().optional().default(false),
    });
    
    export type GetStampParams = z.infer<typeof GetStampParamsSchema>;
  • Registration of the GetStampTool class under the tool name 'get_stamp' in the stampTools export object.
    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,
    };
  • StampchainClient.getStamp method called by the tool handler to fetch stamp data from the API endpoint `/stamps/${stampId}`.
    async getStamp(stampId: number): Promise<Stamp> {
      const response = await this.client.get<StampResponse>(`/stamps/${stampId}`);
      return response.data.data.stamp;
    }
  • Factory function createStampTools that instantiates the GetStampTool for 'get_stamp' with optional API client.
    export function createStampTools(apiClient?: StampchainClient) {
      return {
        get_stamp: new GetStampTool(apiClient),
        search_stamps: new SearchStampsTool(apiClient),
        get_recent_stamps: new GetRecentStampsTool(apiClient),
        get_recent_sales: new GetRecentSalesTool(apiClient),
        get_market_data: new GetMarketDataTool(apiClient),
        get_stamp_market_data: new GetStampMarketDataTool(apiClient),
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool retrieves detailed information but doesn't disclose behavioral traits such as error handling (e.g., what happens with invalid IDs), rate limits, authentication needs, or response format. This leaves significant gaps for an agent to understand how to invoke it safely.

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, efficient sentence that front-loads the core purpose ('retrieve detailed information') and specifies the key constraint ('by its ID'). There is zero waste, and every word earns its place, making it highly concise and well-structured.

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 tool has no annotations, no output schema, and involves retrieving data (which could include complex details like ownership or metadata), the description is incomplete. It doesn't cover what 'detailed information' entails, potential errors, or response structure, leaving the agent with insufficient context for reliable use.

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 fully documents both parameters ('stamp_id' and 'include_base64'). The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain what 'detailed information' includes or how base64 data is structured). Baseline 3 is appropriate as the schema does the heavy lifting.

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 verb ('retrieve') and resource ('detailed information about a specific Bitcoin stamp'), making the purpose evident. It distinguishes from siblings like 'get_recent_stamps' or 'search_stamps' by specifying retrieval of a single stamp by ID. However, it doesn't explicitly contrast with all siblings (e.g., 'get_token_info' might overlap in some contexts).

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 like 'search_stamps' or 'get_token_info'. It mentions retrieving by ID but doesn't clarify prerequisites (e.g., needing a valid stamp ID) or exclusions (e.g., not for batch retrieval). Usage is implied but not explicitly stated.

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