Skip to main content
Glama

extract_yc

Read-only

Extract structured data from Y Combinator company listings to analyze startups by name, batch, tags, and description with freshness timestamps.

Instructions

Scrape YC company listings. Use https://www.ycombinator.com/companies?query=KEYWORD to find startups in a space. Returns name, batch, tags, description per company with freshness timestamp.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesYC companies URL e.g. https://www.ycombinator.com/companies?query=mcp
max_lengthNo

Implementation Reference

  • The MCP tool registration and handler implementation for "extract_yc" in src/server.ts.
    server.registerTool(
      "extract_yc",
      {
        description:
          "Scrape YC company listings. Use https://www.ycombinator.com/companies?query=KEYWORD to find startups in a space. Returns name, batch, tags, description per company with freshness timestamp.",
        inputSchema: z.object({
          url: z.string().url().describe("YC companies URL e.g. https://www.ycombinator.com/companies?query=mcp"),
          max_length: z.number().optional().default(6000),
        }),
        annotations: { readOnlyHint: true, openWorldHint: true },
      },
      async ({ url, max_length }) => {
        try {
          const result = await ycAdapter({ url, maxLength: max_length });
          const ctx = stampFreshness(result, { url, maxLength: max_length }, "ycombinator");
          return { content: [{ type: "text", text: formatForLLM(ctx) }] };
        } catch (err) {
          return { content: [{ type: "text", text: formatSecurityError(err) }] };
        }
      }
    );
  • The core logic for scraping YC data, implemented in ycAdapter.
    export async function ycAdapter(options: ExtractOptions): Promise<AdapterResult> {
      const safeUrl = validateUrl(options.url, "yc");
      options = { ...options, url: safeUrl };
    
      const browser = await chromium.launch({ headless: true });
      const page = await browser.newPage();
    
      // YC company directory is React-rendered — wait for network to settle
      await page.goto(options.url, { waitUntil: "networkidle", timeout: 30000 });
    
      // Wait for company cards to appear
      await page.waitForSelector('a[href*="/companies/"]', { timeout: 15000 }).catch(() => null);
    
      const data = await page.evaluate(`(function() {
        // YC company cards — robust multi-strategy extraction
        var results = [];
    
        // Strategy 1: structured company divs with name + description + batch
        var cards = Array.from(document.querySelectorAll('div[class*="_company_"]'));
    
        if (cards.length === 0) {
          // Strategy 2: anchor links to /companies/* pages
          cards = Array.from(document.querySelectorAll('a[href*="/companies/"]'))
            .filter(function(el) {
              return el.querySelector('span, p, div');
            });
        }
    
        cards.slice(0, 25).forEach(function(el) {
          var allText = el.innerText || el.textContent || "";
          var lines = allText.split('\\n').map(function(l) { return l.trim(); }).filter(Boolean);
    
          // Try to find structured spans
          var spans = Array.from(el.querySelectorAll('span'));
          var name = null, description = null, batch = null;
          var tags = [];
    
          spans.forEach(function(s) {
            var t = s.textContent.trim();
            if (!t) return;
            if (s.className && s.className.toString().includes('Name')) name = t;
            else if (s.className && s.className.toString().includes('Desc')) description = t;
            else if (s.className && s.className.toString().includes('Batch')) batch = t;
            else if (s.className && s.className.toString().includes('Tag')) tags.push(t);
          });
    
          // Fallback to line parsing
          if (!name && lines.length > 0) name = lines[0];
          if (!description && lines.length > 1) description = lines[1];
    
          var link = el.tagName === 'A'
            ? el.getAttribute('href')
            : (el.querySelector('a') ? el.querySelector('a').getAttribute('href') : null);
    
          if (name && name.length > 1 && name.length < 80) {
            results.push({ name, description, batch, tags, link });
          }
        });
    
        return results;
      })()`);
    
      await browser.close();
    
      const typedData = data as Array<{
        name: string | null;
        description: string | null;
        batch: string | null;
        tags: string[];
        link: string | null;
      }>;
    
      if (!typedData.length) {
        return {
          raw: "No YC companies found — page may have changed structure. Try visiting: " + options.url,
          content_date: null,
          freshness_confidence: "low",
        };
      }
    
      const raw = typedData
        .map((r, i) =>
          [
            `[${i + 1}] ${r.name ?? "Unknown"}`,
            `Batch: ${r.batch ?? "Unknown"}`,
            `Tags: ${r.tags?.join(", ") || "none"}`,
            `Description: ${r.description ?? "N/A"}`,
            `Link: ${r.link ? (r.link.startsWith("http") ? r.link : "https://www.ycombinator.com" + r.link) : "N/A"}`,
          ].join("\n")
        )
        .join("\n\n")
        .slice(0, options.maxLength ?? 6000);
    
      return {
        raw,
        content_date: new Date().toISOString().split("T")[0],
        freshness_confidence: "high",
      };
    }
Behavior4/5

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

Annotations declare readOnlyHint=true and openWorldHint=true, indicating safe read operations with external data. The description adds valuable context beyond annotations by specifying the scraping behavior, source website, data freshness aspect, and the types of fields returned. No contradiction with annotations exists.

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 perfectly concise with two sentences that each earn their place: first sentence defines purpose and usage, second sentence specifies return data. No wasted words, front-loaded with the core functionality.

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?

For a scraping tool with readOnlyHint and openWorldHint annotations but no output schema, the description does well by specifying the source website, example URL pattern, and exact return fields. It could be more complete by explaining pagination behavior or error cases, but covers the essential context given the tool's complexity.

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?

Schema description coverage is 50% (only the 'url' parameter has a description). The description adds some value by providing a concrete URL example pattern and mentioning the purpose ('to find startups in a space'), but doesn't explain the 'max_length' parameter's purpose or semantics beyond what the schema provides. With partial schema coverage, the description compensates somewhat but not fully.

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 specific action ('Scrape YC company listings'), target resource ('YC company listings'), and distinguishes from siblings by specifying the YC domain. It provides a concrete example URL pattern and lists the exact data returned (name, batch, tags, description, freshness timestamp).

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('to find startups in a space') with a specific URL pattern example. However, it doesn't explicitly state when NOT to use it or name alternatives among the sibling tools, though the specificity of the YC domain implicitly differentiates it from other extraction tools.

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/PrinceGabriel-lgtm/freshcontext-mcp'

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