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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe important behavioral aspects: whether this is a read-only operation, what happens if the transaction doesn't exist, what data format is returned, or any rate limits or authentication requirements. 'Fetch' implies read-only, but this isn't explicitly confirmed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 7 words, with zero wasted language. It's front-loaded with the core purpose and doesn't include unnecessary elaboration. Every word serves a clear purpose in communicating the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a transaction retrieval tool with no annotations and no output schema, the description is insufficient. It doesn't explain what transaction data is returned, error conditions, or how this differs from get-transaction-receipt. Given the complexity of blockchain transactions and the sibling tools available, more context is needed for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters. The description mentions 'hash or block identifiers' which implies the hash parameter, but doesn't add meaningful context beyond what the schema provides. The description doesn't explain the relationship between hash and chainId parameters or provide usage examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('fetch') and resource ('transaction'), and specifies the input criteria ('given hash or block identifiers'). It distinguishes from siblings like get-transaction-receipt by focusing on transaction data rather than receipt data. However, it doesn't explicitly differentiate from get-block which might also provide transaction data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to use get-transaction-receipt instead, or clarify the relationship with get-block which might contain transaction information. There's no context about prerequisites or typical use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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