Skip to main content
Glama
5ajaki

Safe MCP Server

by 5ajaki

decodeTransactionData

Decode transaction data in hex format using Safe smart contract wallet APIs. Extract and interpret transaction details for clarity and analysis.

Instructions

Decode transaction data using Safe API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesTransaction data in hex format
toNoOptional contract address

Implementation Reference

  • The handler for the 'decodeTransactionData' tool. It performs a POST request to the Safe API's data-decoder endpoint with the transaction data (and optional 'to' address), handles specific HTTP errors, and returns the decoded transaction data as a JSON string.
    case "decodeTransactionData": { const { data, to } = args as any; const response = await fetch(`${SAFE_API_URL}/data-decoder/`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ data, to }), }); if (!response.ok) { if (response.status === 404) { throw new McpError( ErrorCode.InternalError, "Cannot find function selector" ); } if (response.status === 422) { throw new McpError(ErrorCode.InvalidParams, "Invalid data"); } throw new McpError( ErrorCode.InternalError, `Decoder API error: ${response.statusText}` ); } const decodedData = await response.json(); return { content: [ { type: "text", text: JSON.stringify(decodedData, null, 2) }, ], }; }
  • src/index.ts:143-160 (registration)
    Tool registration in the ListTools response, defining the name, description, and input schema for 'decodeTransactionData'.
    { name: "decodeTransactionData", description: "Decode transaction data using Safe API", inputSchema: { type: "object", properties: { data: { type: "string", description: "Transaction data in hex format", }, to: { type: "string", description: "Optional contract address", }, }, required: ["data"], }, },

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/5ajaki/safe-mcp-server'

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