Skip to main content
Glama
bmorphism

Penumbra MCP Server

get_dex_state

Retrieve the current decentralized exchange (DEX) state, including the latest batch auction results, using the Penumbra MCP Server. Enables privacy-preserving insights into DEX activities.

Instructions

Get current DEX state including latest batch auction results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function implementing the logic for the 'get_dex_state' tool. It returns the current DEX state including batch information and active pairs (using mock data).
    private async getDexState() {
      try {
        // TODO: Implement actual DEX state query
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                currentBatchNumber: "12345",
                lastBatchTimestamp: new Date().toISOString(),
                batchInterval: CONFIG.dex.batchInterval,
                minLiquidityAmount: CONFIG.dex.minLiquidityAmount,
                maxPriceImpact: CONFIG.dex.maxPriceImpact,
                activePairs: [
                  {
                    baseAsset: "penumbra/usdc",
                    quoteAsset: "penumbra/eth",
                    lastPrice: "1850.50",
                    volume24h: "1000000"
                  }
                ]
              }, null, 2),
            },
          ],
        };
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching DEX state: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
  • src/index.ts:127-135 (registration)
    Registration of the 'get_dex_state' tool in the ListTools handler, specifying name, description, and empty input schema.
    {
      name: 'get_dex_state',
      description: 'Get current DEX state including latest batch auction results',
      inputSchema: {
        type: 'object',
        properties: {},
        required: [],
      },
    },
  • src/index.ts:169-170 (registration)
    Registration/dispatcher case in the CallToolRequest handler that routes calls to the getDexState() method.
    case 'get_dex_state':
      return await this.getDexState();
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/bmorphism/penumbra-mcp'

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