Skip to main content
Glama
saasus-platform

SaaSus Docs MCP Server

Official

saasusDocsSitemapTool

Retrieve the sitemap XML from SaaSus Platform documentation to access a complete list of URLs, enabling discovery of all pages and site hierarchy for precise navigation or integration with content retrieval tools.

Instructions

Fetch the sitemap XML from SaaSus Platform documentation to get a list of all available URLs. Useful for discovering all documentation pages and their structure, especially when search doesn't return relevant results or you need to browse the complete site hierarchy. Use with saasus-docs-get-content tool to fetch specific article content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core implementation of saasusDocsSitemapTool, including tool definition with execute handler and the fetchSaaSusSitemap helper function that parses the sitemap XML and builds hierarchical structure.
    export const saasusDocsSitemapTool = createTool({ id: "saasus-docs-sitemap", description: "Fetch the sitemap XML from SaaSus Platform documentation to get a list of all available URLs. Useful for discovering all documentation pages and their structure, especially when search doesn't return relevant results or you need to browse the complete site hierarchy. Use with saasus-docs-get-content tool to fetch specific article content.", inputSchema: z.object({}), outputSchema: z.object({ baseUrl: z.string(), structure: z.record(z.any()), }), execute: async () => { return await fetchSaaSusSitemap(); }, }); const fetchSaaSusSitemap = async (): Promise<{ baseUrl: string; structure: Record<string, any>; }> => { const sitemapUrl = "https://docs.saasus.io/ja/sitemap.xml"; const response = await fetch(sitemapUrl); if (!response.ok) { throw new Error( `HTTP ${response.status}: Failed to fetch sitemap from ${sitemapUrl}` ); } const xmlText = await response.text(); // Parse XML using JSDOM const dom = new JSDOM(xmlText, { contentType: "text/xml" }); const document = dom.window.document; const baseUrl = "https://docs.saasus.io"; const paths = Array.from(document.querySelectorAll("url")).map( (urlElement) => { const fullUrl = urlElement.querySelector("loc")?.textContent || ""; return fullUrl.replace(baseUrl, ""); } ); // Build compact hierarchical structure using arrays for leafs only const structure: Record<string, any> = {}; paths.forEach((path) => { if (!path) return; const segments = path.split("/").filter((segment) => segment); let current = structure; segments.forEach((segment, index) => { if (index === segments.length - 1) { // Last segment - set as 1 (endpoint marker) if (typeof current[segment] === "object") { current[segment]["/"] = 1; // Mark as endpoint in existing object } else { current[segment] = 1; // Simple endpoint } } else { // Intermediate segment if (!current[segment]) { current[segment] = {}; } else if (current[segment] === 1) { // Convert endpoint to object with endpoint marker current[segment] = { "/": 1 }; } current = current[segment]; } }); }); return { baseUrl, structure }; };
  • Zod input and output schemas for the tool.
    inputSchema: z.object({}), outputSchema: z.object({ baseUrl: z.string(), structure: z.record(z.any()), }),
  • Registers the saasusDocsSitemapTool in the MCPServer instance.
    export const mcpServer = new MCPServer({ name: "SaaSus Platform Docs Search", version: packageJson.version, tools: { saasusDocsSearchTool, saasusDocsContentTool, saasusDocsSitemapTool, }, });
  • Supporting function that handles the actual sitemap fetching, parsing with JSDOM, and structure building.
    const fetchSaaSusSitemap = async (): Promise<{ baseUrl: string; structure: Record<string, any>; }> => { const sitemapUrl = "https://docs.saasus.io/ja/sitemap.xml"; const response = await fetch(sitemapUrl); if (!response.ok) { throw new Error( `HTTP ${response.status}: Failed to fetch sitemap from ${sitemapUrl}` ); } const xmlText = await response.text(); // Parse XML using JSDOM const dom = new JSDOM(xmlText, { contentType: "text/xml" }); const document = dom.window.document; const baseUrl = "https://docs.saasus.io"; const paths = Array.from(document.querySelectorAll("url")).map( (urlElement) => { const fullUrl = urlElement.querySelector("loc")?.textContent || ""; return fullUrl.replace(baseUrl, ""); } ); // Build compact hierarchical structure using arrays for leafs only const structure: Record<string, any> = {}; paths.forEach((path) => { if (!path) return; const segments = path.split("/").filter((segment) => segment); let current = structure; segments.forEach((segment, index) => { if (index === segments.length - 1) { // Last segment - set as 1 (endpoint marker) if (typeof current[segment] === "object") { current[segment]["/"] = 1; // Mark as endpoint in existing object } else { current[segment] = 1; // Simple endpoint } } else { // Intermediate segment if (!current[segment]) { current[segment] = {}; } else if (current[segment] === 1) { // Convert endpoint to object with endpoint marker current[segment] = { "/": 1 }; } current = current[segment]; } }); }); return { baseUrl, structure }; };

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/saasus-platform/saasus-docs-mcp-server'

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