Skip to main content
Glama
robot-resources

Robot Resources Scraper

scraper_compress_url

Compress web content from URLs into markdown format to reduce token usage by 70-90% compared to raw HTML.

Instructions

Compress web content from a URL for reduced token usage. Returns markdown with 70-90% fewer tokens than raw HTML.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to compress
modeNoFetch mode: 'fast' (plain HTTP), 'stealth' (TLS fingerprint), 'render' (headless browser), 'auto' (fast with fallback). Default: 'auto'
timeoutNoFetch timeout in milliseconds (default: 10000)
maxRetriesNoMax retry attempts (default: 3)

Implementation Reference

  • The 'compressUrl' function is the actual implementation/handler for the 'scraper_compress_url' tool. It fetches the content, extracts it, and converts it to markdown.
    export async function compressUrl({
      url,
      mode,
      timeout,
      maxRetries,
    }: {
      url: string;
      mode?: FetchMode;
      timeout?: number;
      maxRetries?: number;
    }) {
      try {
        const fetchResult = await fetchWithMode(url, mode ?? 'auto', { timeout, maxRetries });
        const originalTokens = estimateTokens(fetchResult.html);
        const extractResult = await extractContent(fetchResult);
        const convertResult = await convertToMarkdown(extractResult);
    
        const compressionRatio =
          originalTokens > 0
            ? Math.round((1 - convertResult.tokenCount / originalTokens) * 100)
            : 0;
    
        return {
          content: [{ type: 'text' as const, text: convertResult.markdown }],
          structuredContent: {
            markdown: convertResult.markdown,
            tokenCount: convertResult.tokenCount,
            title: extractResult.title ?? null,
            author: extractResult.author ?? null,
            siteName: extractResult.siteName ?? null,
            url: fetchResult.url,
            compressionRatio,
          },
        };
      } catch (error) {
        return formatError(url, error);
      }
    }
  • src/server.ts:25-48 (registration)
    Registration of the 'scraper_compress_url' tool in the McpServer.
    server.tool(
      'scraper_compress_url',
      'Compress web content from a URL for reduced token usage. Returns markdown with 70-90% fewer tokens than raw HTML.',
      {
        url: z.string().url().describe('URL to compress'),
        mode: z
          .enum(['fast', 'stealth', 'render', 'auto'])
          .optional()
          .describe("Fetch mode: 'fast' (plain HTTP), 'stealth' (TLS fingerprint), 'render' (headless browser), 'auto' (fast with fallback). Default: 'auto'"),
        timeout: z
          .number()
          .positive()
          .optional()
          .describe('Fetch timeout in milliseconds (default: 10000)'),
        maxRetries: z
          .number()
          .int()
          .min(0)
          .max(10)
          .optional()
          .describe('Max retry attempts (default: 3)'),
      },
      async (args) => compressUrl(args),
    );
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 the token reduction benefit but fails to disclose critical traits like rate limits, authentication needs, error handling, or what happens with invalid URLs. The description is minimal and does not compensate for the lack of annotations, leaving 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 highly concise and front-loaded, consisting of two sentences that directly state the tool's function and outcome without any fluff. Every sentence earns its place by delivering essential information efficiently, making it easy to grasp the tool's purpose 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 a tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral aspects, error cases, and output format beyond 'markdown,' failing to provide sufficient context for safe and effective use. The description does not compensate for the absence of structured data, leaving key operational questions unanswered.

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 has 100% description coverage, providing clear details for all parameters (url, mode, timeout, maxRetries). The description adds no additional parameter semantics beyond what the schema already explains, such as usage examples or implications of mode choices. Thus, it meets the baseline score of 3, as the schema adequately covers parameter information.

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's purpose with a specific verb ('compress') and resource ('web content from a URL'), and distinguishes it from its sibling 'scraper_crawl_url' by focusing on token reduction rather than crawling. It explicitly mentions the outcome: 'Returns markdown with 70-90% fewer tokens than raw HTML.'

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 its sibling 'scraper_crawl_url' or any alternatives. It lacks context about prerequisites, such as when compression is beneficial or when to choose specific modes, offering only a basic functional statement without comparative or exclusionary advice.

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/robot-resources/scraper-mcp'

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