get_market_status
Check if financial markets are open or closed to determine trading availability and schedule planning.
Instructions
Check if markets are open
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:139-157 (handler)The async handler function for the 'get_market_status' tool. It fetches the current market status from the Polygon API endpoint '/v1/marketstatus/now', formats the response as JSON text, and handles errors appropriately.get_market_status: async () => { try { const response = await polygonApi.get('/v1/marketstatus/now'); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error getting market status: ${error.response?.data?.message || error.message}` }], isError: true }; } },
- src/index.ts:330-337 (schema)The input schema definition for the 'get_market_status' tool as provided in the ListTools response. It specifies no required input parameters.{ name: "get_market_status", description: "Check if markets are open", inputSchema: { type: "object", properties: {} } },
- src/index.ts:402-410 (registration)The CallToolRequestHandler registration where tool names like 'get_market_status' are dynamically dispatched to their handlers in the toolHandlers object.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; if (name in toolHandlers) { return await (toolHandlers as any)[name](args || {}); } throw new Error(`Unknown tool: ${name}`); });