docwriter-mcp-server
Version:
A Model Context Protocol (MCP) server for programmatic creation, modification, and compilation of structured LaTeX documents. Enables AI agents and automated workflows to generate reports, articles, and papers from templates, with secure, structured conte
48 lines (47 loc) • 2.08 kB
TypeScript
/**
* @fileoverview Core logic for the docwriter_create_latex_document tool.
* This module handles the creation of a new LaTeX document from a template,
* replacing placeholders and saving it to the configured data path.
* @module src/mcp-server/tools/docwriter_create_latex_document/logic
*/
import { z } from "zod";
import { type RequestContext } from "../../../utils/index.js";
/**
* Zod schema for validating input arguments for the `docwriter_create_latex_document` tool.
*/
export declare const CreateLatexDocumentInputSchema: z.ZodObject<{
title: z.ZodString;
author: z.ZodString;
filename: z.ZodString;
template: z.ZodDefault<z.ZodEnum<["simple_report", "ieee_article", "research_report"]>>;
}, "strip", z.ZodTypeAny, {
title: string;
author: string;
filename: string;
template: "simple_report" | "ieee_article" | "research_report";
}, {
title: string;
author: string;
filename: string;
template?: "simple_report" | "ieee_article" | "research_report" | undefined;
}>;
/**
* TypeScript type inferred from `CreateLatexDocumentInputSchema`.
*/
export type CreateLatexDocumentInput = z.infer<typeof CreateLatexDocumentInputSchema>;
/**
* Defines the structure of the JSON payload returned by the `createLatexDocumentLogic` tool handler.
*/
export interface CreateLatexDocumentResponse {
status: "created";
documentId: string;
documentContent: string;
}
/**
* Processes the core logic for the `docwriter_create_latex_document` tool.
* @param {CreateLatexDocumentInput} params - The validated input parameters for the tool.
* @param {RequestContext} context - The request context for logging and tracing.
* @returns {Promise<CreateLatexDocumentResponse>} A promise that resolves to an object containing the creation status and document details.
* @throws {McpError} If the template is not found, the document already exists, or a file system error occurs.
*/
export declare function createLatexDocumentLogic(params: CreateLatexDocumentInput, context: RequestContext): Promise<CreateLatexDocumentResponse>;