Skip to main content
Glama

extract-web-data

Extract structured JSON data from any public webpage by describing in natural language what data you need.

Instructions

Extracts structured data as JSON from a web page given a URL using a Natural Language description of the data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL of the public webpage to extract data from
promptYesNatural Language description of the data to extract from the page

Implementation Reference

  • Handler function for 'extract-web-data' tool. Calls the AgentQL API to extract structured data from a web page using a URL and natural language prompt.
    // Handler for the 'extract-web-data' tool.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      switch (request.params.name) {
        case EXTRACT_TOOL_NAME: {
          const url = String(request.params.arguments?.url);
          const prompt = String(request.params.arguments?.prompt);
          if (!url || !prompt) {
            throw new Error("Both 'url' and 'prompt' are required");
          }
    
          const endpoint = 'https://api.agentql.com/v1/query-data';
          const response = await fetch(endpoint, {
            method: 'POST',
            headers: {
              'X-API-Key': `${AGENTQL_API_KEY}`,
              'X-TF-Request-Origin': 'mcp-server',
              'Content-Type': 'application/json',
            },
            body: JSON.stringify({
              url: url,
              prompt: prompt,
              params: {
                wait_for: 0,
                is_scroll_to_bottom_enabled: false,
                mode: 'fast',
                is_screenshot_enabled: false,
              },
            }),
          });
    
          if (!response.ok) {
            throw new Error(`AgentQL API error: ${response.statusText}\n${await response.text()}`);
          }
    
          const json = (await response.json()) as AqlResponse;
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(json.data, null, 2),
              },
            ],
          };
  • Input schema for 'extract-web-data' tool: requires 'url' (string) and 'prompt' (string) parameters.
    inputSchema: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'The URL of the public webpage to extract data from',
        },
        prompt: {
          type: 'string',
          description: 'Natural Language description of the data to extract from the page',
        },
      },
      required: ['url', 'prompt'],
    },
  • src/index.ts:25-25 (registration)
    Tool name constant definition for 'extract-web-data' used in registration.
    const EXTRACT_TOOL_NAME = 'extract-web-data';
  • src/index.ts:33-56 (registration)
    Registration of 'extract-web-data' tool in the list of available tools.
    // Handler that lists available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: EXTRACT_TOOL_NAME,
            description:
              'Extracts structured data as JSON from a web page given a URL using a Natural Language description of the data.',
            inputSchema: {
              type: 'object',
              properties: {
                url: {
                  type: 'string',
                  description: 'The URL of the public webpage to extract data from',
                },
                prompt: {
                  type: 'string',
                  description: 'Natural Language description of the data to extract from the page',
                },
              },
              required: ['url', 'prompt'],
            },
          },
        ],
  • Helper interface defining the AgentQL API response shape, used in the handler.
    interface AqlResponse {
      data: object;
    }
Behavior2/5

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

No annotations provided, so description carries full burden. Describes core function but omits important behavioral traits like rate limits, authentication requirements, handling of dynamic content, or error scenarios.

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?

Single concise sentence that is front-loaded and contains only essential information. No wasted words.

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

Completeness3/5

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

Mentions output format (JSON) but lacks details on return structure, error handling, or limitations like URL restrictions or page complexity. Adequate for a simple tool but incomplete for production 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?

Schema coverage is 100% with clear parameter descriptions. The description reinforces the 'prompt' parameter's nature but adds no new meaning beyond what the schema provides.

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?

Clearly states verb (Extracts), resource (structured data as JSON from web page), and method (Natural Language description). Specific and unambiguous.

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?

Implicitly indicates use when needing structured data from a URL via NL description. No siblings to differentiate, but lacks explicit when-not-to-use or alternative methods.

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/tinyfish-io/agentql-mcp'

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