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

NameRequiredDescriptionDefault
urlYes

Input Schema (JSON Schema)

{ "properties": { "url": { "title": "Url", "type": "string" } }, "required": [ "url" ], "type": "object" }

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="错误信息(如果有)")

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