Skip to main content
Glama
boray
by boray

query-events

Retrieve Mina blockchain events by address with filters for token ID, transaction status, and block height range.

Instructions

Query events from the Mina blockchain with optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes
tokenIdNoToken ID to filter transactions
statusNoTransaction status to filter
toNoBlock height to filter transactions
fromNoBlock height to filter transactions

Implementation Reference

  • src/index.ts:91-114 (registration)
    Registration of the 'query-events' MCP tool, including input schema and inline handler function.
    server.tool(
      "query-events",
      "Query events from the Mina blockchain with optional filters",
      {
        address: z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{55,60}$/, 'Invalid Ethereum address format'),
        tokenId: z.string().optional().describe("Token ID to filter transactions"),
        status: z.enum(Object.values(BlockStatusFilter) as [BlockStatusFilter, ...BlockStatusFilter[]]).optional().describe("Transaction status to filter"),
        to: z.number().optional().describe("Block height to filter transactions"),
        from: z.number().optional().describe("Block height to filter transactions"),
      },
      async ({ address, tokenId, status, to, from }) => {
        try {
          const result = await minaClient.queryEvents({address, tokenId, status, to, from});
          return {
            content: [{
              type: "text",
              text: JSON.stringify(result, null, 2)
            }]
          };
        } catch (error) {
          throw new Error(`Failed to query events: ${error}`);
        }
      }
    );
  • Inline handler function for the 'query-events' tool that invokes the GraphQL client and returns formatted JSON response.
    async ({ address, tokenId, status, to, from }) => {
      try {
        const result = await minaClient.queryEvents({address, tokenId, status, to, from});
        return {
          content: [{
            type: "text",
            text: JSON.stringify(result, null, 2)
          }]
        };
      } catch (error) {
        throw new Error(`Failed to query events: ${error}`);
      }
    }
  • Input schema definition using Zod for validating parameters to the 'query-events' tool.
    {
      address: z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{55,60}$/, 'Invalid Ethereum address format'),
      tokenId: z.string().optional().describe("Token ID to filter transactions"),
      status: z.enum(Object.values(BlockStatusFilter) as [BlockStatusFilter, ...BlockStatusFilter[]]).optional().describe("Transaction status to filter"),
      to: z.number().optional().describe("Block height to filter transactions"),
      from: z.number().optional().describe("Block height to filter transactions"),
    },
  • Core helper function in MinaGraphQLClient that constructs and executes the GraphQL query for events based on filter options.
    async queryEvents(filterOptions: EventFilterOptions): Promise<{ events: EventOutput[] }> {
      // Convert filter options to GraphQL input format
      const inputParams = Object.entries(filterOptions)
        .filter(([_, value]) => value !== undefined)
        .map(([key, value]) => `${key}: ${typeof value === 'string' ? `"${value}"` : value}`)
        .join(', ');
    
      const query = `
        query {
          events(input: {${inputParams}}) {
            blockInfo {
              height
              stateHash
              parentHash
              ledgerHash
              chainStatus
              timestamp
              globalSlotSinceHardfork
              globalSlotSinceGenesis
              distanceFromMaxBlockHeight
            }
            eventData {
              accountUpdateId
              data
              transactionInfo {
                status
                hash
                memo
                authorizationKind
                sequenceNumber
                zkappAccountUpdateIds
              }
            }
          }
        }
      `;
    
      return this.client.request(query);
    }
  • TypeScript interface defining the filter options for querying events, used by the client method.
    export interface EventFilterOptions {
      address: string;
      tokenId?: string;
      status?: BlockStatusFilter;
      to?: number;
      from?: number;
    }
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 states 'query events' which implies a read operation, but doesn't specify whether this is a safe read, if it requires authentication, rate limits, pagination, or what the return format looks like. For a tool with 5 parameters and no annotations, this is a significant gap in transparency.

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 ('query events from the Mina blockchain') and adds a useful qualifier ('with optional filters'). There is no wasted text, making it appropriately 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 complexity of a blockchain query tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like safety, performance, or return format, and while schema coverage is high, the lack of output details and usage context leaves gaps for an AI agent to effectively use this tool.

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 80%, so the schema already documents most parameters well. The description adds minimal value beyond the schema by mentioning 'optional filters', but doesn't explain parameter interactions or provide additional context like filter combinations or default behaviors. Baseline 3 is appropriate given the high schema coverage.

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 'query' and resource 'events from the Mina blockchain', making the purpose understandable. However, it doesn't differentiate from sibling tools like 'query-actions' or 'get-network-state', which likely query different types of blockchain data, so it lacks sibling distinction.

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 mentions 'optional filters' but provides no guidance on when to use this tool versus alternatives like 'query-actions' or 'get-network-state'. There are no explicit when/when-not instructions or named alternatives, leaving usage context vague.

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/boray/mcp-mina-archive-node'

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