Skip to main content
Glama
matteoantoci

Marketstack MCP Server

by matteoantoci

get_index_info

Retrieve detailed information for a specific stock market index, such as Australia All Ordinaries, using the Marketstack MCP Server to access accurate financial market data.

Instructions

Get details for a specific stock market index.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYesSpecify your benchmark/index id for your request, e.g. australia_all_ordinaries.

Implementation Reference

  • The main handler function that executes the tool logic by fetching index information from the Marketstack API using the provided index identifier.
    const getIndexInfoHandler = async (input: Input, client: MarketstackClient): Promise<Output> => {
      try {
        const { index } = input;
    
        const apiRequestParams: MarketstackApiParams = {
          endpoint: 'indexinfo',
          index,
        };
    
        const data = await client.fetchApiData(apiRequestParams);
    
        return data;
      } catch (error: unknown) {
        console.error('getIndexInfo tool error:', error);
        const message = error instanceof Error ? error.message : 'An unknown error occurred.';
        throw new Error(`getIndexInfo tool failed: ${message}`);
      }
    };
  • Zod input schema defining the required 'index' parameter for the tool.
    const getIndexInfoInputSchemaShape = {
      index: z.string().describe('Specify your benchmark/index id for your request, e.g. australia_all_ordinaries.'),
    };
  • MCP server registration of the 'get_index_info' tool, providing name, description, input schema, and wrapped handler.
    server.tool(
      getIndexInfoTool.name,
      getIndexInfoTool.description,
      getIndexInfoTool.inputSchemaShape,
      wrapToolHandler((input) => getIndexInfoTool.handler(input, client))
    );
  • Tool definition object that bundles the name, description, schema, and handler for use in registration.
    export const getIndexInfoTool: MarketstackToolDefinition = {
      name: 'get_index_info',
      description: 'Get details for a specific stock market index.',
      inputSchemaShape: getIndexInfoInputSchemaShape,
      handler: getIndexInfoHandler,
    };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/matteoantoci/mcp-marketstack'

If you have feedback or need assistance with the MCP directory API, please join our Discord server