Skip to main content
Glama

get_webpage_content

Retrieves webpage content in markdown format by scraping URLs, with options to control timing and geographic location for data extraction.

Instructions

Retrieve content of a webpage in markdown

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
url_to_scrapeYesThe URL of the webpage to scrape.
wait_before_scrapingNoTime to wait in milliseconds before starting the scrape.
countryNoResidential country to load the request from (e.g., US, CA, GB). Optional.

Implementation Reference

  • The main handler function that fetches the webpage content using the Olostep API, processes the response, and returns markdown content or error.
    handler: async ({ url_to_scrape, wait_before_scraping, country }: { url_to_scrape: string; wait_before_scraping: number; country?: string }, apiKey: string, orbitKey?: string) => {
        try {
            const headers = new Headers({
                'Content-Type': 'application/json',
                'Authorization': `Bearer ${apiKey}`
            });
    
            const payload = {
                url_to_scrape: url_to_scrape,
                wait_before_scraping: wait_before_scraping,
                formats: ["markdown"],
                ...(country && { country: country }),
                ...(orbitKey && { force_connection_id: orbitKey })
            };
    
            const response = await fetch(OLOSTEP_SCRAPE_API_URL, {
                method: 'POST',
                headers: headers,
                body: JSON.stringify(payload)
            });
    
            if (!response.ok) {
                const errorDetails = await response.json();
                return {
                    isError: true,
                    content: [{
                        type: "text",
                        text: `Olostep API Error: ${response.status} ${response.statusText}. Details: ${JSON.stringify(errorDetails)}`
                    }]
                };
            }
    
            const data = await response.json() as OlostepScrapeApiResponse;
    
            if (data.result?.markdown_content) {
                return {
                    content: [{
                        type: "text",
                        text: data.result.markdown_content
                    }]
                };
            } else {
                return {
                    isError: true,
                    content: [{
                        type: "text",
                        text: "Error: No markdown content found in Olostep API response."
                    }]
                };
            }
    
        } catch (error: unknown) {
            return {
                isError: true,
                content: [{
                    type: "text",
                    text: `Error: Failed to scrape webpage. ${error instanceof Error ? error.message : String(error)}`
                }]
            };
        }
    }
  • Zod schema defining the input parameters for the tool: url_to_scrape (required URL), wait_before_scraping (optional ms), country (optional).
    schema: {
        url_to_scrape: z.string().url().describe("The URL of the webpage to scrape."),
        wait_before_scraping: z.number().int().min(0).default(0).describe("Time to wait in milliseconds before starting the scrape."),
        country: z.string().optional().describe("Residential country to load the request from (e.g., US, CA, GB). Optional."),
    },
  • src/index.ts:134-146 (registration)
    MCP server registration of the tool using server.tool(), providing name, description, schema, and a wrapper handler that checks API key and calls the tool's handler.
    server.tool(
        getWebpageMarkdown.name,
        getWebpageMarkdown.description,
        getWebpageMarkdown.schema,
        async (params) => {
            if (!OLOSTEP_API_KEY) return missingApiKeyError;
            const result = await getWebpageMarkdown.handler(params, OLOSTEP_API_KEY, ORBIT_KEY);
            return {
                ...result,
                content: result.content.map(item => ({ ...item, type: item.type as "text" }))
            };
        }
    );
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 'retrieve' and 'scrape', implying a read-only operation, but doesn't address potential issues like rate limits, authentication needs, error handling, or what happens with dynamic content. This is inadequate for a scraping tool with zero annotation coverage.

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 with zero waste. It's front-loaded with the core purpose and includes the output format, making it easy to parse 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?

For a scraping tool with no annotations and no output schema, the description is incomplete. It doesn't explain return values (e.g., structure of markdown content), error conditions, or behavioral traits like handling of JavaScript-rendered pages. This leaves significant gaps for an AI agent to use the tool effectively.

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, so the schema fully documents all three parameters. The description adds no additional meaning beyond what's in the schema, such as explaining why 'wait_before_scraping' might be needed or how 'country' affects the scrape. 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 'retrieve' and resource 'content of a webpage', specifying the output format 'in markdown'. However, it doesn't differentiate from sibling tools like 'scrape_website' or 'batch_scrape_urls', which likely have overlapping functionality.

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?

No guidance is provided on when to use this tool versus alternatives such as 'scrape_website' or 'batch_scrape_urls'. The description lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage from the tool name alone.

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/olostep/olostep-mcp-server'

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