UNPKG

@cyanheads/filesystem-mcp-server

Version:

A Model Context Protocol (MCP) server for platform-agnostic file capabilities, including advanced search and replace, and directory tree traversal

64 lines (63 loc) 1.91 kB
import { z } from 'zod'; import { RequestContext } from '../../../utils/internal/requestContext.js'; declare const DiffBlockSchema: z.ZodObject<{ search: z.ZodString; replace: z.ZodString; }, "strip", z.ZodTypeAny, { replace: string; search: string; }, { replace: string; search: string; }>; export declare const UpdateFileInputSchema: z.ZodObject<{ path: z.ZodString; blocks: z.ZodArray<z.ZodObject<{ search: z.ZodString; replace: z.ZodString; }, "strip", z.ZodTypeAny, { replace: string; search: string; }, { replace: string; search: string; }>, "many">; useRegex: z.ZodDefault<z.ZodBoolean>; replaceAll: z.ZodDefault<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { path: string; blocks: { replace: string; search: string; }[]; useRegex: boolean; replaceAll: boolean; }, { path: string; blocks: { replace: string; search: string; }[]; useRegex?: boolean | undefined; replaceAll?: boolean | undefined; }>; export type UpdateFileInput = z.infer<typeof UpdateFileInputSchema>; export type DiffBlock = z.infer<typeof DiffBlockSchema> & { applied?: boolean; }; export interface UpdateFileOutput { message: string; updatedPath: string; blocksApplied: number; blocksFailed: number; } /** * Applies an array of search/replace blocks sequentially to the file content. * * @param {UpdateFileInput} input - The input object containing path, blocks, and options. * @param {RequestContext} context - The request context. * @returns {Promise<UpdateFileOutput>} A promise resolving with update status. * @throws {McpError} For path errors, file not found, I/O errors, or invalid regex patterns. */ export declare const updateFileLogic: (input: UpdateFileInput, context: RequestContext) => Promise<UpdateFileOutput>; export {};