Skip to main content
Glama

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; }
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