Skip to main content
Glama
Rainmen-xia

Chrome Debug MCP Server

by Rainmen-xia

get_page_content

Extract HTML content from the current webpage using Chrome debugging for browser automation and persistent sessions.

Instructions

获取当前页面的HTML内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the get_page_content tool logic. It retrieves the HTML content of the current page using Puppeteer's page.content() and returns it in the logs field of BrowserActionResult.
    async getPageContent(): Promise<BrowserActionResult> {
    	if (!this.page) {
    		return {
    			success: false,
    			error: "浏览器未启动或页面不存在"
    		};
    	}
    
    	try {
    		const content = await this.page.content();
    		return {
    			success: true,
    			logs: content
    		};
    	} catch (error) {
    		return {
    			success: false,
    			error: error instanceof Error ? error.message : String(error)
    		};
    	}
    }
  • src/index.ts:225-227 (registration)
    Registration/dispatch point in the CallToolRequestSchema handler where the get_page_content tool call is routed to BrowserSession.getPageContent().
    case "get_page_content":
    	result = await this.browserSession.getPageContent();
    	break;
  • Tool schema definition including name, description, and empty input schema (no parameters required) registered in the ListToolsRequestSchema handler.
    	{
    		name: "get_page_content",
    		description: "获取当前页面的HTML内容",
    		inputSchema: {
    			type: "object",
    			properties: {},
    		},
    	},
    ] as Tool[],
  • Helper function to generate success message for the get_page_content tool.
    case "get_page_content":
    	return "✅ 页面内容获取完成";

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/Rainmen-xia/chrome-debug-mcp'

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