Skip to main content
Glama
5ajaki

Safe MCP Server

by 5ajaki

getSafeTransactions

Retrieve all transactions for a Safe address with optional pagination. Use this tool to query, manage, and analyze transaction details for multisig wallets on the Safe MCP Server.

Instructions

Get all transactions for a Safe address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesSafe address
limitNoNumber of transactions to return
offsetNoOffset for pagination

Implementation Reference

  • Handler function for the getSafeTransactions tool. Fetches all transactions for a given Safe address from the Safe API, with optional pagination parameters.
    case "getSafeTransactions": {
      const { address, limit = 100, offset = 0 } = args as any;
      const data = await this.fetchSafeApi(
        `/safes/${address}/all-transactions/`,
        {
          limit: limit.toString(),
          offset: offset.toString(),
          ordering: "-timestamp",
        }
      );
      return {
        content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
      };
    }
  • src/index.ts:107-128 (registration)
    Tool registration in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: "getSafeTransactions",
      description: "Get all transactions for a Safe address",
      inputSchema: {
        type: "object",
        properties: {
          address: {
            type: "string",
            description: "Safe address",
          },
          limit: {
            type: "number",
            description: "Number of transactions to return",
          },
          offset: {
            type: "number",
            description: "Offset for pagination",
          },
        },
        required: ["address"],
      },
    },
  • Input schema definition for the getSafeTransactions tool, specifying parameters like address (required), limit, and offset.
    inputSchema: {
      type: "object",
      properties: {
        address: {
          type: "string",
          description: "Safe address",
        },
        limit: {
          type: "number",
          description: "Number of transactions to return",
        },
        offset: {
          type: "number",
          description: "Offset for pagination",
        },
      },
      required: ["address"],
    },
  • Helper method used by getSafeTransactions to make API requests to the Safe API with proper error handling.
    private async fetchSafeApi(
      endpoint: string,
      params?: Record<string, string>
    ): Promise<any> {
      const url = new URL(`${SAFE_API_URL}${endpoint}`);
      if (params) {
        Object.entries(params).forEach(([key, value]) => {
          url.searchParams.append(key, value);
        });
      }
    
      const response = await fetch(url.toString());
      if (!response.ok) {
        throw new McpError(
          ErrorCode.InternalError,
          `Safe API error: ${response.statusText}`
        );
      }
      return response.json();
    }
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/5ajaki/safe-mcp-server'

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