save_mcp_docs
Store MCP documentation securely by saving text with a unique key for easy retrieval and future reference, enhancing project organization on the MCP Maker server.
Instructions
Saves MCP documentation text directly and stores it for future reference
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc_text | Yes | ||
| key | Yes |
Implementation Reference
- src/tools/save-docs.ts:18-42 (handler)The core handler function for the save_mcp_docs tool. Validates input using Zod schema, initializes documentation storage if needed, calls saveDocumentation helper, and returns success or error response.
export async function saveMcpDocs( options: DocOptions ): Promise<{ success: boolean; message: string }> { try { // Validate options const validatedOptions = saveDocsSchema.parse(options); // Initialize docs storage if it doesn't exist yet await initDocsStorage(); // Save the documentation await saveDocumentation(validatedOptions.key, validatedOptions.doc_text); return { success: true, message: `Documentation saved successfully with key: ${validatedOptions.key}`, }; } catch (error: any) { console.error(chalk.red("Error saving documentation:"), error); return { success: false, message: `Error saving documentation: ${error.message || String(error)}`, }; } } - src/server.ts:114-128 (registration)Registers the save_mcp_docs tool with the MCP server, including name, description, input schema validation, and delegation to the saveMcpDocs handler.
// Register the save_mcp_docs tool server.tool( "save_mcp_docs", "Saves MCP documentation text directly and stores it for future reference", { key: z.string().min(1), doc_text: z.string().min(1), }, async (params: DocOptions) => { const result = await saveMcpDocs(params); return { content: [{ type: "text", text: result.message }], }; } ); - src/tools/save-docs.ts:10-13 (schema)Zod schema defining the input structure for save_mcp_docs (key and doc_text), used for validation in the handler.
export const saveDocsSchema = z.object({ key: z.string().min(1), doc_text: z.string().min(1), }); - src/utils/docs.ts:28-40 (helper)Helper utility that persists the documentation content to a Markdown file in the .docs directory, called by the handler.
export const saveDocumentation = async ( key: string, docText: string ): Promise<void> => { try { const filePath = path.join(DOCS_DIR, `${key}.md`); await writeFile(filePath, docText); console.log(chalk.green(`Documentation saved: ${key}`)); } catch (error) { console.error(chalk.red(`Error saving documentation ${key}:`), error); throw error; } }; - src/utils/docs.ts:20-23 (helper)Helper utility that ensures the documentation storage directory (.docs) exists, called by the handler.
export const initDocsStorage = async (): Promise<void> => { await ensureDir(DOCS_DIR); console.log(chalk.green("Documentation storage initialized")); };