get_mcp_doc_section
Retrieve a specific section of MCP documentation using a key and section title to locate and access relevant content for MCP server projects.
Instructions
Get a specific section of MCP documentation by key and section title
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | ||
| section_title | No |
Implementation Reference
- src/tools/get-doc-section.ts:18-59 (handler)Main handler function that validates input using Zod schema, initializes docs storage, retrieves the specific documentation section using helper function, handles errors, and returns structured result.
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) }`, }; } } - src/tools/get-doc-section.ts:10-13 (schema)Zod schema for input validation of the get_mcp_doc_section tool parameters.
export const docSectionSchema = z.object({ key: z.string().min(1), section_title: z.string().optional(), }); - src/server.ts:162-182 (registration)Registration of the get_mcp_doc_section tool on the MCP server, including inline Zod schema, description, and handler invocation.
server.tool( "get_mcp_doc_section", "Get a specific section of MCP documentation by key and section title", { key: z.string().min(1), section_title: z.string().optional(), }, async (params: DocSectionOptions) => { const result = await getMcpDocSection(params); return { content: [ { type: "text", text: result.success && result.content ? result.content : result.message, }, ], }; } ); - src/types.ts:86-89 (schema)TypeScript interface defining the input options for the get_mcp_doc_section tool.
export interface DocSectionOptions { key: string; section_title?: string; }