Skip to main content
Glama
TylerFlar

claude-fidelity-mcp

by TylerFlar

fidelity_get_quote

Get the current price for a stock or ETF symbol through Fidelity. Provide a ticker (e.g., AAPL) to receive the quote for investment decisions.

Instructions

Get the current price for a stock/ETF symbol via Fidelity's trade page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesThe stock/ETF ticker symbol (e.g., AAPL, SPY).

Implementation Reference

  • src/index.ts:201-230 (registration)
    Registration of the 'fidelity_get_quote' tool on the MCP server with Zod schema for the symbol parameter and inline handler that calls getQuote().
    // ─── Get Quote ──────────────────────────────────────────────────────────────────
    
    server.tool(
      "fidelity_get_quote",
      "Get the current price for a stock/ETF symbol via Fidelity's trade page.",
      {
        symbol: z.string().describe("The stock/ETF ticker symbol (e.g., AAPL, SPY)."),
      },
      async ({ symbol }) => {
        try {
          const quote = await getQuote(symbol);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(quote, null, 2),
              },
            ],
          };
        } catch (e) {
          return {
            content: [
              {
                type: "text",
                text: `Failed to get quote: ${e instanceof Error ? e.message : String(e)}`,
              },
            ],
            isError: true,
          };
        }
  • Core handler function getQuote() that navigates to Fidelity's trade page, enters the symbol, reads the last price, and optionally fetches extended hours price.
    export async function getQuote(symbol: string): Promise<QuoteResult> {
      await navigateToTrade();
      await enterSymbol(symbol);
    
      const { price, isExtendedHours } = await getLastPrice();
    
      const result: QuoteResult = {
        symbol: symbol.toUpperCase(),
        lastPrice: price,
        isExtendedHours,
      };
    
      // Try to get extended hours price
      if (!isExtendedHours) {
        const enabled = await enableExtendedHours();
        if (enabled) {
          const extPrice = await getLastPrice();
          result.extendedHoursPrice = extPrice.price;
        }
      }
    
      return result;
    }
  • Type definition for QuoteResult, the return type of the getQuote handler.
    export interface QuoteResult {
      symbol: string;
      lastPrice: number;
      extendedHoursPrice?: number;
      isExtendedHours: boolean;
    }
  • Helper function enterSymbol() that fills the symbol input and waits for the quote panel to load.
    async function enterSymbol(symbol: string): Promise<void> {
      const page = await getPage();
    
      const symbolInput = page.getByLabel("Symbol", { exact: true });
      await symbolInput.fill(symbol);
      await symbolInput.press("Enter");
    
      // Wait for quote to load
      await page.waitForSelector("#quote-panel", { timeout: 15000 });
      await waitForLoadingComplete(page);
    
      // Dismiss any autocomplete dropdown by clicking outside the symbol input
      await page.locator("#quote-panel").click();
      await page.waitForTimeout(500);
    }
  • Helper function getLastPrice() that reads the stock price from the DOM and checks if extended hours trading is active.
    async function getLastPrice(): Promise<{
      price: number;
      isExtendedHours: boolean;
    }> {
      const page = await getPage();
    
      const priceSpan = page.locator("#eq-ticket__last-price > span.last-price");
      const priceText = await priceSpan.textContent({ timeout: 10000 });
    
      if (!priceText) {
        throw new Error("Could not read stock price.");
      }
    
      const price = parseFloat(priceText.replace(/[$,]/g, ""));
      if (isNaN(price)) {
        throw new Error(`Invalid price: ${priceText}`);
      }
    
      // Check extended hours
      let isExtendedHours = false;
      try {
        const extToggle = page.locator("#eq-ticket_extendedhour");
        if (await extToggle.isVisible({ timeout: 2000 })) {
          const toggleWrapper = page.locator(".eq-ticket__extendedhour-toggle");
          const classes = (await toggleWrapper.getAttribute("class")) ?? "";
          if (classes.includes("pvd-switch--on")) {
            isExtendedHours = true;
          }
        }
      } catch {
        // Not in extended hours
      }
    
      return { price, isExtendedHours };
    }
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It fails to mention that the tool is read-only (non-destructive), any authentication requirements, rate limits, or that it scrapes data from a webpage. The description is silent on these important aspects.

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 sentence of 12 words, with no unnecessary information. It is extremely concise and front-loaded.

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

Completeness4/5

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

Given the tool's simplicity (one parameter, no nested objects, no output schema), the description is mostly complete. However, it lacks details about the return format (e.g., price as a string or number), which would be helpful for an agent. Still, it covers the core functionality.

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 input schema covers the single symbol parameter with 100% description coverage. The tool description adds no further semantic information beyond the schema, so a baseline of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the tool gets the current price for a stock/ETF symbol via Fidelity's trade page, using a specific verb and resource. It distinguishes from siblings like fidelity_place_order which are about trading, not quoting.

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 such as fidelity_get_positions or fidelity_place_order. There is no mention of prerequisites or context for usage.

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

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/TylerFlar/claude-fidelity-mcp'

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