Skip to main content
Glama

fetch-docs

Retrieve Insforge documentation for backend setup, SDKs, and components. Start with essential instructions, then access specific guides for database, authentication, storage, functions, AI integration, or real-time features.

Instructions

Fetch Insforge documentation. Use "instructions" for essential backend setup (MANDATORY FIRST), or select specific SDK docs for database, auth, storage, functions, or AI integration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docTypeYes Documentation type: "instructions" (essential backend setup - use FIRST), "db-sdk" (database operations), "storage-sdk" (file storage), "functions-sdk" (edge functions), "auth-components-react" (authentication components for React+Vite applications), "auth-components-nextjs" (authentication components for Next.js applications), "ai-integration-sdk" (AI features), "real-time" (real-time pub/sub through WebSockets)

Implementation Reference

  • Core handler logic for the 'fetch-docs' tool. Fetches documentation using fetchDocumentation helper, adds background context, and handles specific errors like 404.
    withUsageTracking('fetch-docs', async ({ docType }) => { try { const content = await fetchDocumentation(docType); return await addBackgroundContext({ content: [ { type: 'text', text: content, }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; // Friendly error for not found (likely due to old backend version) if (errMsg.includes('404') || errMsg.toLowerCase().includes('not found')) { return { content: [{ type: 'text' as const, text: `Documentation for "${docType}" is not available. This is likely because your backend version is too old and doesn't support this documentation endpoint yet. This won't affect the functionality of the tools - they will still work correctly.` }], }; } // Generic error response - no background context return { content: [{ type: 'text' as const, text: `Error fetching ${docType} documentation: ${errMsg}` }], }; } })
  • Registration of the 'fetch-docs' tool on the MCP server, including name, description, input schema, and handler function.
    'fetch-docs', 'Fetch Insforge documentation. Use "instructions" for essential backend setup (MANDATORY FIRST), or select specific SDK docs for database, auth, storage, functions, or AI integration.', { docType: docTypeSchema }, withUsageTracking('fetch-docs', async ({ docType }) => { try { const content = await fetchDocumentation(docType); return await addBackgroundContext({ content: [ { type: 'text', text: content, }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; // Friendly error for not found (likely due to old backend version) if (errMsg.includes('404') || errMsg.toLowerCase().includes('not found')) { return { content: [{ type: 'text' as const, text: `Documentation for "${docType}" is not available. This is likely because your backend version is too old and doesn't support this documentation endpoint yet. This won't affect the functionality of the tools - they will still work correctly.` }], }; } // Generic error response - no background context return { content: [{ type: 'text' as const, text: `Error fetching ${docType} documentation: ${errMsg}` }], }; } }) );
  • Input schema definition for the tool using imported docTypeSchema Zod schema.
    docType: docTypeSchema },
  • Helper function that performs the HTTP request to fetch documentation from the backend API endpoint `/api/docs/${docType}` and processes/replaces URLs in the content.
    const fetchDocumentation = async (docType: string): Promise<string> => { try { const response = await fetch(`${API_BASE_URL}/api/docs/${docType}`, { method: 'GET', headers: { 'Content-Type': 'application/json', }, }); // Check for 404 before processing response if (response.status === 404) { throw new Error('Documentation not found. This feature may not be supported in your project version. Please contact the Insforge team for assistance.'); } const result = await handleApiResponse(response); if (result && typeof result === 'object' && 'content' in result) { let content = result.content; // Replace all example/placeholder URLs with actual API_BASE_URL // Handle URLs whether they're in backticks, quotes, or standalone // Preserve paths after the domain by only replacing the base URL content = content.replace(/http:\/\/localhost:7130/g, API_BASE_URL); content = content.replace(/https:\/\/your-app\.region\.insforge\.app/g, API_BASE_URL); return content; } throw new Error('Invalid response format from documentation endpoint'); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; throw new Error(`Unable to retrieve ${docType} documentation: ${errMsg}`); } };

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/InsForge/insforge-mcp'

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