get-network-state
Retrieve current Mina blockchain network state data for monitoring and analysis.
Instructions
Get the current state of the Mina network
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get-network-state"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:116-133 (registration)Registers the "get-network-state" MCP tool with no input parameters. The handler fetches network state via GraphQL client and returns it as JSON text.
server.tool( "get-network-state", "Get the current state of the Mina network", {}, async () => { try { const result = await minaClient.queryNetworkState(); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { throw new Error(`Failed to get network state: ${error}`); } } ); - src/index.ts:120-132 (handler)The MCP tool handler function that executes the logic: queries network state and formats response.
async () => { try { const result = await minaClient.queryNetworkState(); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { throw new Error(`Failed to get network state: ${error}`); } } - src/graphql-client.ts:143-156 (helper)Core implementation: performs GraphQL query to retrieve Mina network state (canonical and pending max block heights).
async queryNetworkState(): Promise<{ networkState: NetworkStateOutput }> { const query = ` query { networkState { maxBlockHeight { canonicalMaxBlockHeight pendingMaxBlockHeight } } } `; return this.client.request(query); } - src/graphql-client.ts:121-123 (schema)TypeScript interface defining the structure of the network state output data.
export interface NetworkStateOutput { maxBlockHeight: MaxBlockHeightInfo; } - src/graphql-client.ts:72-75 (schema)TypeScript interface for max block height information used in network state.
export interface MaxBlockHeightInfo { canonicalMaxBlockHeight: number; pendingMaxBlockHeight: number; }