view_orderbook
View current bids and asks on the exchange with spread information. Filter orders by function ID or service category to analyze market activity.
Instructions
See current bids and asks on the exchange, with spread information. Filter by function or category.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| functionId | No | Filter by specific function ID | |
| category | No | Filter by service category |
Implementation Reference
- src/tools/exchange.ts:83-101 (registration)Complete registration of the view_orderbook tool with MCP server, including schema definition and handler function
// view_orderbook — See current bids and asks server.tool( 'view_orderbook', 'See current bids and asks on the exchange, with spread information. Filter by function or category.', { functionId: z.string().optional().describe('Filter by specific function ID'), category: z.string().optional().describe('Filter by service category'), }, { readOnlyHint: true, openWorldHint: true }, async (params) => { const result = await client.getOrderBook({ functionId: params.functionId, category: params.category, }); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }], }; } ); - src/tools/exchange.ts:92-100 (handler)Handler function that executes view_orderbook logic by calling client.getOrderBook and returning JSON formatted results
async (params) => { const result = await client.getOrderBook({ functionId: params.functionId, category: params.category, }); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }], }; } - src/tools/exchange.ts:87-90 (schema)Zod schema defining view_orderbook input parameters: optional functionId and category filters
{ functionId: z.string().optional().describe('Filter by specific function ID'), category: z.string().optional().describe('Filter by service category'), }, - src/client.ts:268-273 (handler)AgoraApiClient.getOrderBook method that makes HTTP GET request to /orderbook endpoint with optional query parameters
async getOrderBook(params?: { functionId?: string; category?: string; }): Promise<any> { return this.request('/orderbook', { params: params as any }); }