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
44 lines (43 loc) • 1.71 kB
TypeScript
/**
* @fileoverview Core logic for the docwriter_search_replace tool.
* This module handles searching for and replacing text within a LaTeX document.
* @module src/mcp-server/tools/searchAndReplace/logic
*/
import { z } from "zod";
import { type RequestContext } from "../../../utils/index.js";
/**
* Zod schema for validating input arguments for the `docwriter_search_replace` tool.
*/
export declare const SearchAndReplaceInputSchema: z.ZodObject<{
documentId: z.ZodString;
searchTerm: z.ZodString;
replacementText: z.ZodString;
}, "strip", z.ZodTypeAny, {
documentId: string;
searchTerm: string;
replacementText: string;
}, {
documentId: string;
searchTerm: string;
replacementText: string;
}>;
/**
* TypeScript type inferred from `SearchAndReplaceInputSchema`.
*/
export type SearchAndReplaceInput = z.infer<typeof SearchAndReplaceInputSchema>;
/**
* Defines the structure of the JSON payload returned by the `searchAndReplaceLogic` tool handler.
*/
export interface SearchAndReplaceResponse {
status: "replaced";
documentId: string;
occurrences: number;
}
/**
* Processes the core logic for the `docwriter_search_replace` tool.
* @param {SearchAndReplaceInput} params - The validated input parameters for the tool.
* @param {RequestContext} context - The request context for logging and tracing.
* @returns {Promise<SearchAndReplaceResponse>} A promise that resolves to an object containing the replacement status.
* @throws {McpError} If the document is not found or a file system error occurs.
*/
export declare function searchAndReplaceLogic(params: SearchAndReplaceInput, context: RequestContext): Promise<SearchAndReplaceResponse>;