Skip to main content
Glama
saasus-platform

SaaSus Docs MCP Server

Official

saasusDocsSitemapTool

Fetch the sitemap XML to list all documentation URLs and browse the complete site hierarchy when search results are insufficient.

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlYes
structureYes

Implementation Reference

  • The main tool definition and execute handler for saasusDocsSitemapTool. Uses createTool with id 'saasus-docs-sitemap'. The execute function calls fetchSaaSusSitemap() which fetches the sitemap XML from https://docs.saasus.io/ja/sitemap.xml, parses it with JSDOM, extracts all URLs, and builds a compact hierarchical structure of paths.
    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 };
    };
  • Input and output schemas for the tool. Input is empty (no parameters needed). Output has baseUrl (string) and structure (record of any) representing the hierarchical sitemap.
    inputSchema: z.object({}),
    outputSchema: z.object({
      baseUrl: z.string(),
      structure: z.record(z.any()),
  • The fetchSaaSusSitemap helper function that does the actual work: fetches sitemap XML, parses it, extracts URL paths, and builds a nested hierarchical structure object from the URL paths.
    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 };
    };
  • Registers saasusDocsSitemapTool as a tool on the MCPServer instance named 'SaaSus Platform Docs Search', making it available as an MCP tool.
    import { MCPServer } from "@mastra/mcp";
    import { saasusDocsSearchTool } from "../tools/saasus-search-tool.js";
    import { saasusDocsContentTool } from "../tools/saasus-content-tool.js";
    import { saasusDocsSitemapTool } from "../tools/saasus-sitemap-tool.js";
    import packageJson from "../../../package.json" with { type: "json" };
    
    export const mcpServer = new MCPServer({
      name: "SaaSus Platform Docs Search",
      version: packageJson.version,
      tools: {
        saasusDocsSearchTool,
        saasusDocsContentTool,
        saasusDocsSitemapTool,
      },
    });
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. Description states it fetches sitemap XML, a read operation, but does not detail output format or any side effects. Output schema exists, slightly reducing burden.

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?

Three concise sentences, each adding value: action, use case, and tool combination. No redundancy.

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?

Sufficient for a no-parameter tool with output schema. Provides purpose and usage context, though could mention that output is XML sitemap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters; baseline score of 4 is appropriate. No additional parameter info needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it fetches the sitemap XML from SaaSus Platform documentation to list all available URLs, distinguishing it from search and content tools.

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?

Provides when to use: when search fails or need complete site hierarchy. Also suggests combining with content tool, but lacks explicit when not to use.

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

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