Skip to main content
Glama

get_page_info

Retrieve webpage metadata like title, description, and status code to assess accessibility and basic information without extracting full content. Ideal for quick page checks in web scraping workflows.

Instructions

Get basic information about a webpage (title, description, status).

This is a lightweight tool for quickly checking page accessibility and getting basic metadata without full content extraction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'get_page_info' MCP tool. It is registered via the @app.tool() decorator, validates the input URL, fetches basic page metadata using the WebScraper.simple_scraper, and returns structured information in PageInfoResponse format.
    @app.tool()
    async def get_page_info(
        url: Annotated[
            str,
            Field(
                ...,
                description="""目标网页 URL,必须包含协议前缀(http://或https://),用于获取页面基础信息和元数据。
                    这是一个轻量级工具,不会提取完整页面内容""",
            ),
        ],
    ) -> PageInfoResponse:
        """
        Get basic information about a webpage (title, description, status).
    
        This is a lightweight tool for quickly checking page accessibility and
        getting basic metadata without full content extraction.
    
        Returns:
            PageInfoResponse object containing success status, URL, status_code, title, meta_description, and domain.
            Useful for quick page validation and metadata extraction.
        """
        try:
            # Validate inputs
            parsed = urlparse(url)
            if not parsed.scheme or not parsed.netloc:
                raise ValueError("Invalid URL format")
    
            logger.info(f"Getting page info for: {url}")
    
            # Use simple scraper for quick info
            result = await web_scraper.simple_scraper.scrape(url, extract_config={})
    
            if "error" in result:
                return PageInfoResponse(
                    success=False, url=url, status_code=0, error=result["error"]
                )
    
            return PageInfoResponse(
                success=True,
                url=result.get("url", url),
                title=result.get("title"),
                description=result.get("meta_description"),
                status_code=result.get("status_code", 200),
                content_type=result.get("content_type"),
                content_length=result.get("content_length"),
            )
    
        except Exception as e:
            logger.error(f"Error getting page info for {url}: {str(e)}")
            return PageInfoResponse(success=False, url=url, status_code=0, error=str(e))
  • Pydantic BaseModel defining the output response schema for the get_page_info tool, including fields for success status, page metadata, and error handling.
    class PageInfoResponse(BaseModel):
        """Response model for page information."""
    
        success: bool = Field(..., description="操作是否成功")
        url: str = Field(..., description="页面URL")
        title: Optional[str] = Field(default=None, description="页面标题")
        description: Optional[str] = Field(default=None, description="页面描述")
        status_code: int = Field(..., description="HTTP状态码")
        content_type: Optional[str] = Field(default=None, description="内容类型")
        content_length: Optional[int] = Field(default=None, description="内容长度")
        last_modified: Optional[str] = Field(default=None, description="最后修改时间")
        error: Optional[str] = Field(default=None, description="错误信息(如果有)")
Behavior3/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. It discloses that the tool is 'lightweight' and for 'quickly checking,' which hints at performance characteristics, but doesn't detail behavioral traits like rate limits, authentication needs, error handling, or what 'status' specifically means (e.g., HTTP status codes). It adds some context but lacks comprehensive behavioral disclosure.

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 appropriately sized and front-loaded: the first sentence states the core purpose, and the second adds usage context. Every sentence earns its place by clarifying the tool's scope and when to use it, with zero wasted words.

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?

Given the tool's low complexity (1 parameter) and the presence of an output schema (which handles return values), the description is reasonably complete. It covers purpose and usage guidelines well. However, with no annotations and low schema coverage, it could benefit from more behavioral details, but the output schema mitigates some gaps.

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 1 parameter (url) with 0% description coverage, meaning the schema provides no semantic details. The description doesn't add any parameter-specific information beyond what's implied by the tool's purpose (e.g., it doesn't specify URL format requirements or validation). With low schema coverage, the description doesn't compensate adequately, but since there's only one parameter, the baseline is slightly higher.

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: 'Get basic information about a webpage (title, description, status).' It specifies the verb 'get' and the resource 'webpage' with concrete examples of what information is retrieved. However, it doesn't explicitly differentiate from sibling tools like 'scrape_webpage' or 'extract_structured_data' beyond mentioning it's 'lightweight' and for 'quickly checking page accessibility.'

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: 'for quickly checking page accessibility and getting basic metadata without full content extraction.' This implies it's suitable for lightweight checks versus more intensive extraction tools. However, it doesn't explicitly name alternatives or state when not to use it, such as for detailed content analysis.

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

Related 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/ThreeFish-AI/scrapy-mcp'

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