Skip to main content
Glama

get-transaction

Retrieve blockchain transactions using specific hashes or chain identifiers with the MCPilot server, enabling secure and direct interaction with blockchains through MetaMask.

Instructions

Get the transactions given hashes or chain identifiers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainIdNo
hashYes

Implementation Reference

  • Handler function that fetches the transaction details using wagmi's getTransaction and returns it as JSON string.
    execute: async (args) => { const hash = args.hash as Address const chainId = args.chainId as typeof wagmiConfig['chains'][number]['id'] const result = await getTransaction(wagmiConfig, { hash, chainId, }) return { content: [ { type: "text", text: JSONStringify(result), }, ], } },
  • Input schema using Zod: hash (string), chainId (optional number).
    parameters: z.object({ hash: z.string(), chainId: z.coerce.number().optional(), }),
  • Function that registers the get-transaction tool on the FastMCP server, including name, description, schema, and handler.
    export function registerGetTransactionTools(server: FastMCP): void { server.addTool({ name: "get-transaction", description: "Get the transactions given hashes or chain identifiers", parameters: z.object({ hash: z.string(), chainId: z.coerce.number().optional(), }), execute: async (args) => { const hash = args.hash as Address const chainId = args.chainId as typeof wagmiConfig['chains'][number]['id'] const result = await getTransaction(wagmiConfig, { hash, chainId, }) return { content: [ { type: "text", text: JSONStringify(result), }, ], } }, }); };
  • Top-level registration call that adds the get-transaction tool to the main MetaMask MCP server.
    registerGetTransactionTools(server);

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/mcpilot'

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