desktop-commander-marcus-ver
Version:
MCP server for terminal operations and file editing
86 lines (85 loc) • 3.87 kB
JavaScript
import { z } from "zod";
console.error("Loading schemas.ts");
// Config tools schemas
export const GetConfigArgsSchema = z.object({});
export const SetConfigValueArgsSchema = z.object({
key: z.string(),
value: z.any(),
});
// Empty schemas
export const ListProcessesArgsSchema = z.object({});
// Terminal tools schemas
export const ExecuteCommandArgsSchema = z.object({
command: z.string(),
timeout_ms: z.number(),
shell: z.string().optional(),
});
export const ReadOutputArgsSchema = z.object({
pid: z.number(),
timeout_ms: z.number().optional(),
});
export const ForceTerminateArgsSchema = z.object({
pid: z.number(),
});
export const ListSessionsArgsSchema = z.object({});
export const KillProcessArgsSchema = z.object({
pid: z.number(),
});
//EDITED: Filesystem tools schemas
export const ReadFileArgsSchema = z.object({
input: z.string().describe("relative path and the file name to read contents from. E.g: For app.py file, it's code/app.py or for requirements.txt, it's code/requirements.txt"),
path: z.string().describe('The root directory for the project. Must be relative path. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'),
isUrl: z.boolean().optional().default(false),
offset: z.number().optional().default(0),
length: z.number().optional().default(10000),
});
export const ReadMultipleFilesArgsSchema = z.object({
paths: z.array(z.string()),
});
// EDITED: Write new app.py file
export const WriteFileArgsSchema = z.object({
input: z.string().describe("relative path and the file name to write into. E.g: For app.py file, it's code/app.py or for requirements.txt, it's code/requirements.txt"),
path: z.string().describe('The root directory for the project. Must be relative path. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'),
content: z.string(),
mode: z.enum(['rewrite', 'append']).default('rewrite'),
});
// EDITED: Create Directory for code folder
export const CreateDirectoryArgsSchema = z.object({
input: z.string().describe('relative path of the folder name to create.'),
path: z.string().describe('The root directory for the project. Must be relative path. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'),
});
// EDITED: List directory of files
export const ListDirectoryArgsSchema = z.object({
path: z.string().describe('The root directory for the project. Must be relative path. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'),
});
export const MoveFileArgsSchema = z.object({
source: z.string(),
destination: z.string(),
});
export const SearchFilesArgsSchema = z.object({
path: z.string(),
pattern: z.string(),
timeoutMs: z.number().optional(),
});
export const GetFileInfoArgsSchema = z.object({
path: z.string(),
});
// Search tools schema
export const SearchCodeArgsSchema = z.object({
path: z.string(),
pattern: z.string(),
filePattern: z.string().optional(),
ignoreCase: z.boolean().optional(),
maxResults: z.number().optional(),
includeHidden: z.boolean().optional(),
contextLines: z.number().optional(),
timeoutMs: z.number().optional(),
});
// EDITED: Edit tools schema
export const EditBlockArgsSchema = z.object({
input: z.string().default('code/app.py').describe('relative path to the Python code file.'),
path: z.string().describe('The root directory for the project. Must be relative path. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'), // formerly 'file_path'
old_string: z.string().describe('The old code to search from the file'),
new_string: z.string().describe('The new code to replace the old code in the file'),
expected_replacements: z.number().optional().default(1),
});