list_exchange_tickers
Retrieve all available tickers for a specific financial exchange by providing its MIC code. Supports pagination with customizable limit and offset for efficient data handling.
Instructions
Obtain all available tickers for a specific exchange.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Specify a pagination limit (number of results per page) for your API request. Default limit value is `100`, maximum allowed limit value is `1000`. | |
| mic | Yes | Obtain all available tickers for a specific exchange by attaching the exchange MIC, e.g. `XNAS`. | |
| offset | No | Specify a pagination offset value for your API request. Example: An offset value of `100` combined with a limit value of 10 would show results 100-110. Default value is `0`, starting with the first available result. |
Implementation Reference
- Handler function that executes the tool logic: fetches exchange tickers using MarketstackClient with parameters mic, limit, offset.const listExchangeTickersHandler = async (input: Input, client: MarketstackClient): Promise<Output> => { try { const { mic, limit, offset } = input; // Construct the endpoint path with the MIC and /tickers const endpoint = `exchanges/${mic}/tickers`; const apiRequestParams: MarketstackApiParams = { endpoint, ...(limit && { limit }), // Include if limit is provided ...(offset && { offset }), // Include if offset is provided }; const data = await client.fetchApiData(apiRequestParams); return data; } catch (error: unknown) { console.error('listExchangeTickers tool error:', error); const message = error instanceof Error ? error.message : 'An unknown error occurred.'; throw new Error(`listExchangeTickers tool failed: ${message}`); } };
- Zod input schema shape defining parameters: mic (required string), limit and offset (optional numbers).const listExchangeTickersInputSchemaShape = { mic: z .string() .describe('Obtain all available tickers for a specific exchange by attaching the exchange MIC, e.g. `XNAS`.'), limit: z .number() .int() .min(1) .max(1000) .optional() .default(100) .describe( 'Specify a pagination limit (number of results per page) for your API request. Default limit value is `100`, maximum allowed limit value is `1000`.' ), offset: z .number() .int() .min(0) .optional() .default(0) .describe( 'Specify a pagination offset value for your API request. Example: An offset value of `100` combined with a limit value of 10 would show results 100-110. Default value is `0`, starting with the first available result.' ), };
- src/tools/referenceData/listExchangeTickers.ts:66-71 (registration)Tool definition object exporting the tool name, description, schema, and handler.export const listExchangeTickersTool: MarketstackToolDefinition = { name: 'list_exchange_tickers', description: 'Obtain all available tickers for a specific exchange.', inputSchemaShape: listExchangeTickersInputSchemaShape, handler: listExchangeTickersHandler, };
- src/tools/referenceData/index.ts:57-62 (registration)MCP server registration of the tool using server.tool() with wrapped handler.server.tool( listExchangeTickersTool.name, listExchangeTickersTool.description, listExchangeTickersTool.inputSchemaShape, wrapToolHandler((input) => listExchangeTickersTool.handler(input, client)) );