Skip to main content
Glama

get-transaction

Fetch blockchain transaction details using a transaction hash and chain ID to retrieve specific on-chain data through MetaMask MCP.

Instructions

Fetch transaction given hash or block identifiers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesHash to get transaction.
chainIdNoID of chain to use when fetching data.

Implementation Reference

  • The async execute function implementing the tool: fetches transaction using wagmi/core's getTransaction and returns JSON stringified result.
    execute: async (args) => { const result = await getTransaction(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; },
  • Zod input schema defining parameters: hash (TransactionHash type) and optional chainId.
    parameters: z.object({ hash: TransactionHash.describe("Hash to get transaction."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), }),
  • The server.addTool call within registerGetTransactionTools that registers the tool with FastMCP server.
    server.addTool({ name: "get-transaction", description: "Fetch transaction given hash or block identifiers.", parameters: z.object({ hash: TransactionHash.describe("Hash to get transaction."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), }), execute: async (args) => { const result = await getTransaction(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; }, });
  • Call to registerGetTransactionTools within the main registerTools function.
    registerGetTransactionTools(server, wagmiConfig);

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/Xiawpohr/metamask-mcp'

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