Skip to main content
Glama
cuongpo

Rootstock MCP Server

by cuongpo

get_transaction

Retrieve detailed information about a specific transaction on the Rootstock blockchain by providing its unique hash using the Rootstock MCP Server.

Instructions

Get details of a transaction by hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesTransaction hash

Implementation Reference

  • Primary MCP tool handler for 'get_transaction'. Fetches transaction details from Rootstock client and formats response with explorer link.
    private async handleGetTransaction(params: GetTransactionParams) {
      try {
        const transaction = await this.rootstockClient.getTransaction(params.hash);
        const explorerUrl = this.rootstockClient.getExplorerUrl();
        const txExplorerLink = `${explorerUrl}/tx/${transaction.hash}`;
    
        return {
          content: [
            {
              type: 'text',
              text: `Transaction Details:\n\nHash: ${transaction.hash}\nExplorer: ${txExplorerLink}\n\nFrom: ${transaction.from}\nTo: ${transaction.to}\nValue: ${transaction.value} ${this.rootstockClient.getCurrencySymbol()}\nGas Used: ${transaction.gasUsed}\nBlock: ${transaction.blockNumber}\nStatus: ${transaction.status}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to get transaction: ${error}`);
      }
    }
  • src/index.ts:256-268 (registration)
    Tool registration in getAvailableTools() method, defining name, description, and input schema for listTools response.
      name: 'get_transaction',
      description: 'Get details of a transaction by hash',
      inputSchema: {
        type: 'object',
        properties: {
          hash: {
            type: 'string',
            description: 'Transaction hash',
          },
        },
        required: ['hash'],
      },
    },
  • TypeScript interface defining input parameters for the get_transaction tool.
    export interface GetTransactionParams {
      hash: string;
    }
  • Alternative handler/registration in Smithery server variant using direct server.tool() call.
    // Get Transaction Tool
    server.tool(
      "get_transaction",
      "Get details of a transaction by hash",
      {
        hash: z.string().describe("Transaction hash"),
      },
      async ({ hash }) => {
        try {
          const transaction = await rootstockClient.getTransaction(hash);
          return {
            content: [
              {
                type: "text",
                text: `Transaction Details:\n\nHash: ${transaction.hash}\nFrom: ${transaction.from}\nTo: ${transaction.to}\nValue: ${transaction.value}\nGas Used: ${transaction.gasUsed}\nStatus: ${transaction.status}\nBlock: ${transaction.blockNumber}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting transaction: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Core blockchain client method implementing the transaction retrieval logic using ethers provider.
    async getTransaction(hash: string): Promise<TransactionResponse> {
      try {
        const [tx, receipt] = await Promise.all([
          this.getProvider().getTransaction(hash),
          this.getProvider().getTransactionReceipt(hash),
        ]);
    
        if (!tx) {
          throw new Error('Transaction not found');
        }
    
        return {
          hash: tx.hash,
          from: tx.from,
          to: tx.to || '',
          value: ethers.formatEther(tx.value),
          gasUsed: receipt?.gasUsed.toString(),
          gasPrice: tx.gasPrice?.toString(),
          blockNumber: receipt?.blockNumber,
          blockHash: receipt?.blockHash,
          status: receipt ? (receipt.status === 1 ? 'confirmed' : 'failed') : 'pending',
        };
      } catch (error) {
        throw new Error(`Failed to get transaction: ${error}`);
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden but only states what the tool does without disclosing behavioral traits. It lacks details on permissions, rate limits, error handling, or what 'details' include, which is insufficient for a tool with potential complexity.

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 a single, efficient sentence with zero waste, front-loading the core action and resource. It is appropriately sized for a simple tool, making it easy to parse quickly.

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?

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'details' entail, potential return values, or error cases, which is inadequate for a tool that might involve network or data retrieval complexities.

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?

The description adds minimal meaning beyond the input schema, which has 100% coverage for the single parameter 'hash'. It implies the parameter is used to fetch details but doesn't elaborate on format or constraints, meeting the baseline for high schema coverage.

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 verb ('Get details') and resource ('transaction by hash'), making the purpose specific and understandable. However, it does not differentiate from siblings like 'get_block' or 'get_token_info' beyond the resource type, which slightly limits distinction.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't specify if this is for retrieving confirmed transactions only or how it differs from other data-fetching tools in the sibling list, leaving usage context implied at best.

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

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/cuongpo/rootstock-mcp'

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