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
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_dex_state"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:283-319 (handler)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();