get_last_trade_price
Retrieve the most recent executed trade price for a Polymarket prediction market token to monitor real-time market activity and price movements.
Instructions
Get the last executed trade price for a Polymarket token.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token_id | Yes | CLOB token ID |
Implementation Reference
- src/tools/clob/prices.ts:45-62 (handler)The definition and handler implementation for the `get_last_trade_price` tool.
server.tool( "get_last_trade_price", "Get the last executed trade price for a Polymarket token.", { token_id: z.string().describe("CLOB token ID"), }, async (args) => { try { const data = await clob.getLastTradePrice(args.token_id); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${(error as Error).message}` }], isError: true, }; } }, ); - src/api/clob.ts:30-34 (helper)The underlying API method that fetches the last trade price data from the server.
async getLastTradePrice(tokenId: string): Promise<ClobLastTradePrice> { return this.client.clob<ClobLastTradePrice>("/last-trade-price", { token_id: tokenId, }); }