Skip to main content
Glama

GET_TRANSACTION

Retrieve transaction details from OpenOcean's DEX contracts on supported blockchain networks using the transaction hash.

Instructions

Get Transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNoThe blockchain network to execute the transaction on. uses fraxtal as defaultfraxtal
hashYesHash from the OpenOcean contract on the blockchain.

Implementation Reference

  • The handler function that implements the core logic of the GET_TRANSACTION tool. It resolves the chain, uses ChainService to fetch the transaction by hash, and returns the result as JSON.
    export const getTransaction = async (args: z.infer<typeof hashParamsSchema>) => { try { const inputChain = args.chain.toLowerCase(); const chainObject = getChainFromName(inputChain); console.error(`[GET_TRANSACTION] Using chain: ${chainObject.name}`, args); const service = new ChainService(); const tx = await service.getTransaction(chainObject.id, args.hash); if (tx instanceof Error) { return `Error fetching getTransaction: ${tx.message}`; } return JSON.stringify(tx, null, 2); } catch (error: unknown) { const message = error instanceof Error ? error.message : "An unknown error occurred while fetching getTransaction."; console.error(`[GET_TRANSACTION] Error: ${message}`); throw new Error(`Failed to fetch getTransaction: ${message}`); } }
  • Zod schema defining the input parameters for the GET_TRANSACTION tool: optional chain (defaults to 'fraxtal') and required hash (validated with viem's isHash).
    export const hashParamsSchema = z.object({ chain: z .string() .optional() .describe( "The blockchain network to execute the transaction on. uses fraxtal as default", ) .default("fraxtal"), hash: z .string() .refine(isHash, { message: "Invalid hash" }) .describe("Hash from the OpenOcean contract on the blockchain."), });
  • Tool object registration in tools/index.ts, defining name, description, input schema, and handler reference.
    getTransaction: { name: "GET_TRANSACTION", description: "Get Transaction", parameters: hashParamsSchema, execute: chainExecute.getTransaction },
  • src/index.ts:17-17 (registration)
    Final registration of the GET_TRANSACTION tool to the FastMCP server.
    server.addTool(tools.getTransaction);

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/openocean-finance/openocean-mcp'

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