Skip to main content
Glama
Fadi88

LLM Inference Pricing Research Server

by Fadi88

extract_scraped_info

Extract structured pricing data from scraped LLM inference provider websites to analyze and compare costs across services like CloudRift, DeepInfra, Fireworks, and Groq.

Instructions

Extract information about a scraped website.

Args:
    identifier: The provider name, full URL, or domain to look for
    
Returns:
    Formatted JSON string with the scraped information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'extract_scraped_info' tool, decorated with @mcp.tool() for registration. It retrieves scraped metadata and content based on the provided identifier (provider name, URL, or domain) and returns it as JSON.
    @mcp.tool()
    def extract_scraped_info(identifier: str) -> str:
        """
        Extract information about a scraped website.
        
        Args:
            identifier: The provider name, full URL, or domain to look for
            
        Returns:
            Formatted JSON string with the scraped information
        """
        
        logger.info(f"Extracting information for identifier: {identifier}")
        
        if not os.path.exists(SCRAPE_DIR):
            return json.dumps({"error": "No scraped content found."})
    
        metadata_file = os.path.join(SCRAPE_DIR, "scraped_metadata.json")
        if not os.path.exists(metadata_file):
            return json.dumps({"error": "Metadata file not found."})
    
        try:
            with open(metadata_file, "r") as f:
                metadata = json.load(f)
        except json.JSONDecodeError:
            return json.dumps({"error": "Invalid metadata file."})
    
        # Search for the identifier
        found_data = None
        
        # Check if identifier matches a provider key directly
        if identifier in metadata:
            found_data = metadata[identifier]
        else:
            # Search by url or domain
            for provider, data in metadata.items():
                if identifier == data.get("url") or identifier == data.get("domain"):
                    found_data = data
                    break
        
        if found_data:
            # Read content files
            content_data = {}
            if "content_files" in found_data:
                for fmt, filename in found_data["content_files"].items():
                    file_path = os.path.join(SCRAPE_DIR, filename)
                    if os.path.exists(file_path):
                        with open(file_path, "r", encoding="utf-8") as f:
                            content_data[fmt] = f.read()
            
            found_data["content"] = content_data
            return json.dumps(found_data, indent=2)
        else:
            return json.dumps({"error": f"No information found for {identifier}"})
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool extracts information, implying a read operation, but doesn't cover key aspects like whether it requires authentication, has rate limits, or what happens if the identifier isn't found. The description is too vague for a tool with no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the purpose stated first, followed by brief sections for args and returns. There's no wasted text, but the structure could be slightly improved by integrating usage context more naturally.

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?

Given the tool has an output schema (returns 'Formatted JSON string'), the description doesn't need to explain return values in detail. However, with no annotations and low schema coverage, it lacks completeness regarding behavioral traits and usage guidelines. It's minimally adequate but has clear gaps for a tool with one parameter.

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 schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that 'identifier' can be a 'provider name, full URL, or domain to look for,' which clarifies the parameter's purpose beyond the schema's basic type. However, it doesn't detail format constraints or examples, leaving gaps in understanding.

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 tool's purpose: 'Extract information about a scraped website.' It specifies the verb ('extract') and resource ('scraped website'), making it understandable. However, it doesn't explicitly differentiate from its sibling 'scrape_websites' (which likely performs scraping rather than extraction), so it doesn't reach the highest score.

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. It doesn't mention the sibling tool 'scrape_websites' or explain the relationship between scraping and extraction. There's no context about prerequisites, such as whether scraping must occur first, leaving usage unclear.

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/Fadi88/UDACITY_MCP'

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