get_exchange_details
Retrieve detailed information about a specific stock exchange using its MIC identifier. Ideal for accessing key financial market data through the Marketstack MCP Server.
Instructions
Obtain information about a specific stock exchange.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mic | Yes | Obtain information about a specific stock exchange by attaching its MIC identification to your API request URL, e.g. `XNAS`. |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"mic": {
"description": "Obtain information about a specific stock exchange by attaching its MIC identification to your API request URL, e.g. `XNAS`.",
"type": "string"
}
},
"required": [
"mic"
],
"type": "object"
}
Implementation Reference
- The async handler function that fetches exchange details for a given MIC using the Marketstack client by constructing the endpoint `exchanges/${mic}` and calling client.fetchApiData.const getExchangeDetailsHandler = async (input: Input, client: MarketstackClient): Promise<Output> => { try { const { mic } = input; // Construct the endpoint path with the MIC const endpoint = `exchanges/${mic}`; const apiRequestParams: MarketstackApiParams = { endpoint, }; const data = await client.fetchApiData(apiRequestParams); return data; } catch (error: unknown) { console.error('getExchangeDetails tool error:', error); const message = error instanceof Error ? error.message : 'An unknown error occurred.'; throw new Error(`getExchangeDetails tool failed: ${message}`); } };
- Zod input schema shape defining the required 'mic' string parameter for the tool.const getExchangeDetailsInputSchemaShape = { mic: z .string() .describe( 'Obtain information about a specific stock exchange by attaching its MIC identification to your API request URL, e.g. `XNAS`.' ), };
- src/tools/referenceData/index.ts:50-55 (registration)Registers the 'get_exchange_details' tool with the MCP server, providing name, description, input schema, and a wrapped handler function.server.tool( getExchangeDetailsTool.name, getExchangeDetailsTool.description, getExchangeDetailsTool.inputSchemaShape, wrapToolHandler((input) => getExchangeDetailsTool.handler(input, client)) );