Skip to main content
Glama
matteoantoci

Marketstack MCP Server

by matteoantoci

get_etf_holdings

Retrieve comprehensive ETF data, including holdings, by specifying a ticker and optional date range using the Marketstack MCP Server tool.

Instructions

Get complete set of exchange-traded funds data based on the unique identifier code of an ETF.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
date_fromNoFilter results based on a specific timeframe by passing a from-date in `YYYY-MM-DD` format.
date_toNoFilter results based on a specific timeframe by passing an end-date in `YYYY-MM-DD` format.
tickerYesTo get results based on a ETF ticker.

Implementation Reference

  • The main handler function that implements the get_etf_holdings tool logic. It constructs API parameters for the 'etfholdings' endpoint using the input ticker and optional dates, fetches data via MarketstackClient, and returns the response.
    const getEtfHoldingsHandler = async (input: Input, client: MarketstackClient): Promise<Output> => {
      try {
        const { ticker, date_from, date_to } = input;
    
        const apiRequestParams: MarketstackApiParams = {
          endpoint: 'etfholdings',
          ticker,
          ...(date_from && { date_from }), // Include if date_from is provided
          ...(date_to && { date_to }), // Include if date_to is provided
        };
    
        const data = await client.fetchApiData(apiRequestParams);
    
        return data;
      } catch (error: unknown) {
        console.error('getEtfHoldings tool error:', error);
        const message = error instanceof Error ? error.message : 'An unknown error occurred.';
        throw new Error(`getEtfHoldings tool failed: ${message}`);
      }
    };
  • Zod-based input schema shape defining the parameters for the get_etf_holdings tool: required ticker and optional date_from/date_to.
    const getEtfHoldingsInputSchemaShape = {
      ticker: z.string().describe('To get results based on a ETF ticker.'),
      date_from: z
        .string()
        .optional()
        .describe('Filter results based on a specific timeframe by passing a from-date in `YYYY-MM-DD` format.'),
      date_to: z
        .string()
        .optional()
        .describe('Filter results based on a specific timeframe by passing an end-date in `YYYY-MM-DD` format.'),
    };
  • Registration of the get_etf_holdings tool with the MCP server using server.tool(), referencing the tool definition imported from getEtfHoldings.ts.
    server.tool(
      getEtfHoldingsTool.name,
      getEtfHoldingsTool.description,
      getEtfHoldingsTool.inputSchemaShape,
      wrapToolHandler((input) => getEtfHoldingsTool.handler(input, client))
    );
  • Tool definition export that bundles name, description, schema, and handler for get_etf_holdings, used in higher-level registration.
    export const getEtfHoldingsTool: MarketstackToolDefinition = {
      name: 'get_etf_holdings',
      description: 'Get complete set of exchange-traded funds data based on the unique identifier code of an ETF.',
      inputSchemaShape: getEtfHoldingsInputSchemaShape,
      handler: getEtfHoldingsHandler,
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'complete set' but doesn't specify what data is included, format, pagination, rate limits, or authentication needs. For a read operation with no annotation coverage, this leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of financial data retrieval, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'complete set of exchange-traded funds data' includes, return format, or error handling, leaving the agent with incomplete context for proper use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the input schema already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond implying the 'ticker' is a unique identifier, which aligns with the schema. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('complete set of exchange-traded funds data'), specifying it's based on a unique identifier code. It distinguishes from siblings like 'get_ticker_details' or 'get_ticker_info' by focusing on ETF holdings specifically, though it doesn't explicitly differentiate them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_ticker_details' or 'list_etf_tickers', nor does it mention prerequisites or exclusions. It only states the basic purpose without contextual usage information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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