Skip to main content
Glama

getSlot

Retrieve the current slot number on the Solana blockchain using the Solana MCP Server's RPC tool. Essential for tracking block progress and coordinating transactions.

Instructions

Get the current slot

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": {}, "type": "object" }

Implementation Reference

  • The asynchronous handler function that implements the getSlot tool logic. It fetches the current Solana blockchain slot using the connection.getSlot() method and returns it in a structured MCP response format, with error handling.
    async () => { try { const slot = await connection.getSlot(); return { content: [ { type: "text", text: `Current slot: ${slot}`, }, ], }; } catch (err) { const error = err as Error; return { content: [ { type: "text", text: `Failed to retrieve current slot: ${error.message}`, }, ], }; } }
  • src/index.ts:27-54 (registration)
    The server.tool() call that registers the 'getSlot' tool with the MCP server, specifying its name, description, schema (empty), and handler function.
    server.tool( "getSlot", "Get the current slot", {}, async () => { try { const slot = await connection.getSlot(); return { content: [ { type: "text", text: `Current slot: ${slot}`, }, ], }; } catch (err) { const error = err as Error; return { content: [ { type: "text", text: `Failed to retrieve current slot: ${error.message}`, }, ], }; } } );
  • Empty input schema object, indicating the getSlot tool requires no parameters.
    {},

Other Tools

Related 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/akc2267/solana-mcp-server'

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