binance_market_exchangeInfo
Retrieve exchange information and symbol filters to understand trading parameters and restrictions on Binance.
Instructions
Get exchange information including filters per symbol.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/market.ts:44-56 (handler)The handler implementation of the 'binance_market_exchangeInfo' tool. Defines the tool object with name, description, parameters schema reference, and the async run() function that fetches exchangeInfo from the binance client and returns the data, handling errors with toToolError.export const tool_exchange_info: BinanceTool = { name: "binance_market_exchangeInfo", description: "Get exchange information including filters per symbol.", parameters: exchangeInfoSchema, async run() { try { const res = await binance.exchangeInfo(); return res.data; } catch (err) { throw toToolError(err); } } };
- src/tools/market.ts:12-13 (schema)Zod input schema for the tool (empty object since no parameters required).const exchangeInfoSchema = z.object({});
- src/index.ts:15-23 (registration)The tools array that includes 'tool_exchange_info' which is then registered to the FastMCP server.const tools = [ tool_market_price, tool_market_klines, tool_exchange_info, tool_account_balances, tool_open_orders, tool_place_order, tool_cancel_order, ];
- src/index.ts:25-40 (registration)The registration loop that adds the 'binance_market_exchangeInfo' tool (and others) to the MCP server using server.addTool, wrapping the tool's run function in an execute handler with JSON formatting and error handling.tools.forEach((tool) => { server.addTool({ name: tool.name, description: tool.description, parameters: tool.parameters, execute: async (args) => { try { const result = await tool.run(args); return JSON.stringify(result, null, 2); } catch (error) { const handled = error instanceof ToolError ? error : new ToolError((error as Error).message); throw handled; } }, }); });
- src/util/errors.ts:9-12 (helper)Helper function toToolError used in the tool handler to convert errors (e.g., from Binance API) into standardized ToolError instances.export function toToolError(err: unknown): ToolError { const message = extractMessage(err); return new ToolError(message); }