Skip to main content
Glama

parse_sitemap_content

Extract and process sitemap data from XML or text content to retrieve structured information, with optional inclusion of page details for comprehensive analysis.

Instructions

Parse a sitemap directly from its XML or text content

Input Schema

NameRequiredDescriptionDefault
contentYesThe content of the sitemap (XML, text, etc.)
include_pagesNoWhether to include page details in the response

Input Schema (JSON Schema)

{ "properties": { "content": { "description": "The content of the sitemap (XML, text, etc.)", "title": "Content", "type": "string" }, "include_pages": { "default": false, "description": "Whether to include page details in the response", "title": "Include Pages", "type": "boolean" } }, "required": [ "content" ], "title": "parse_sitemap_contentArguments", "type": "object" }

Implementation Reference

  • The main handler function for the 'parse_sitemap_content' tool. It is decorated with @mcp.tool, defining the tool schema inline via Pydantic Field annotations. Parses sitemap content using sitemap_from_str from the usp library and returns a JSON-serialized dictionary representation of the sitemap.
    @mcp.tool(description="Parse a sitemap directly from its XML or text content") async def parse_sitemap_content( ctx: Context, content: str = Field( ..., description="The content of the sitemap (XML, text, etc.)" ), include_pages: bool = Field( False, description="Whether to include page details in the response" ), ) -> str: """Parse a sitemap from its content. This tool parses a sitemap directly from its XML or text content and returns a structured representation. """ try: logger.info("Parsing sitemap from content") parsed_sitemap = sitemap_from_str(content) return safe_json_dumps(parsed_sitemap.to_dict(with_pages=include_pages)) except Exception as e: error_msg = f"Error parsing sitemap content: {str(e)}" logger.error(error_msg) return safe_json_dumps({"error": error_msg})

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/mugoosse/sitemap-mcp-server'

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