Skip to main content
Glama

MCP Maker

get-doc-section.ts1.74 kB
/** * Get MCP Documentation Section Tool */ import chalk from "chalk"; import { z } from "zod"; import { DocSectionOptions } from "../types.js"; import { getDocumentationSection, initDocsStorage } from "../utils/docs.js"; // Schema for validating input export const docSectionSchema = z.object({ key: z.string().min(1), section_title: z.string().optional(), }); /** * Get a specific section of MCP documentation */ export async function getMcpDocSection( options: DocSectionOptions ): Promise<{ success: boolean; message: string; content?: string }> { try { // Validate options const validatedOptions = docSectionSchema.parse(options); // Initialize docs storage if it doesn't exist yet await initDocsStorage(); // Get the documentation section const content = await getDocumentationSection( validatedOptions.key, validatedOptions.section_title ); if (!content) { return { success: false, message: validatedOptions.section_title ? `Section "${validatedOptions.section_title}" not found in documentation "${validatedOptions.key}"` : `Documentation "${validatedOptions.key}" not found`, }; } return { success: true, message: validatedOptions.section_title ? `Retrieved section "${validatedOptions.section_title}" from documentation "${validatedOptions.key}"` : `Retrieved documentation "${validatedOptions.key}"`, content, }; } catch (error: any) { console.error(chalk.red("Error retrieving documentation section:"), error); return { success: false, message: `Error retrieving documentation section: ${ error.message || String(error) }`, }; } }

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/CaptainCrouton89/mcp-maker'

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