Skip to main content
Glama
90barricade93

MSFS SDK MCP Server

get_doc_content

Retrieve detailed content from Microsoft Flight Simulator SDK documentation pages to access specific sections like overview, examples, or API references.

Instructions

Get detailed content from a specific MSFS SDK documentation page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the documentation page to retrieve
sectionNoSpecific section to extract (e.g., "overview", "examples", "api-reference")

Implementation Reference

  • The primary handler function executing the 'get_doc_content' tool: fetches HTML from the provided URL, parses with Cheerio, extracts main content (specific section if provided), title, code examples, and returns formatted text response.
    async getDocumentationContent(
      url: string,
      section?: string
    ): Promise<{ content: Array<{ type: string; text: string }> }> {
      try {
        const fetchResponse = await fetch(url);
    
        if (!fetchResponse.ok) {
          throw new Error(`Failed to fetch documentation: ${fetchResponse.status}`);
        }
    
        const html = await fetchResponse.text();
        const $ = cheerio.load(html);
    
        // Remove navigation and headers
        $('nav, header, footer, .navigation, .toc').remove();
    
        let contentText = '';
        let title = $('title').text() || 'MSFS SDK Documentation';
    
        if (section) {
          // Try to find specific section
          const sectionElement = $(`#${section}, .${section}, [data-section="${section}"]`);
          if (sectionElement.length > 0) {
            contentText = sectionElement.text().trim();
          } else {
            contentText = $('main, .content, body').text().trim();
          }
        } else {
          contentText = $('main, .content, body').text().trim();
        }
    
        // Extract code examples
        const codeExamples: string[] = [];
        $('code, pre').each((_, element) => {
          const code = $(element).text().trim();
          if (code.length > 10) { // Filter out small snippets
            codeExamples.push(code);
          }
        });
    
        const formattedContent = `**${title}**\n\nURL: ${url}\n\n${contentText.substring(0, 4000)}${contentText.length > 4000 ? '...' : ''}`;
    
        let finalResponse = formattedContent;
    
        if (codeExamples.length > 0) {
          finalResponse += '\n\n**Code Examples:**\n';
          codeExamples.slice(0, 3).forEach((example, index) => {
            finalResponse += `\n\nExample ${index + 1}:\n\`\`\`\n${example}\n\`\`\``;
          });
        }
    
        return {
          content: [
            {
              type: 'text',
              text: finalResponse,
            },
          ],
        };
    
      } catch (error) {
        throw new Error(`Failed to get documentation content: ${error}`);
      }
    }
  • Input schema definition for the 'get_doc_content' tool, specifying required 'url' parameter and optional 'section'.
      name: 'get_doc_content',
      description: 'Get detailed content from a specific MSFS SDK documentation page',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'URL of the documentation page to retrieve',
          },
          section: {
            type: 'string',
            description: 'Specific section to extract (e.g., "overview", "examples", "api-reference")',
          }
        },
        required: ['url']
      }
    },
  • src/index.ts:137-145 (registration)
    Tool registration and dispatch in the main CallToolRequest handler switch for direct 'get_doc_content' calls.
    case 'get_doc_content':
      if (!args?.url) {
        throw new Error('URL parameter is required');
      }
      return await this.documentationService.getDocumentationContent(
        String(args.url),
        args.section ? String(args.section) : undefined
      );
  • src/index.ts:170-175 (registration)
    Tool dispatch registration within the natural language query parsing switch case.
    case 'get_doc_content':
      return await this.documentationService.getDocumentationContent(
        String(parsedCommand.arguments.url),
        parsedCommand.arguments.section ? String(parsedCommand.arguments.section) : undefined
      );
  • Natural language parsing helper that detects 'Get content for [url]' patterns and maps them to the 'get_doc_content' tool with extracted URL.
    const contentPattern = /^Get\s+content\s+for\s+(https?:\/\/.+)$/i;
    const contentMatch = command.match(contentPattern);
    
    if (contentMatch) {
      const url = contentMatch[1];
      return {
        tool: "get_doc_content",
        arguments: {
          url: url
        }
      };
    }

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/90barricade93/MSFS-SDK-MCP'

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