feat: add read_file tool
This commit is contained in:
@@ -99,7 +99,7 @@ function getShellInstructions(
|
||||
case "restricted":
|
||||
return `### Shell commands\n\nUse the \`${t("shell")}\` MCP tool for all shell command execution. This tool provides a secure environment with filtered credentials. Do NOT use any native shell tool — it is disabled for security. For long-running processes, use \`shell({ command, background: true })\`. Use \`${t("kill_background")}\` to stop background processes.`;
|
||||
case "enabled":
|
||||
return `### Shell commands\n\nUse the \`${t("shell")}\` MCP tool for all shell command execution (unrestricted environment, credentials available).`;
|
||||
return `### Shell commands\n\nUse your native shell tool for shell command execution.`;
|
||||
default: {
|
||||
const _exhaustive: never = shell;
|
||||
return _exhaustive satisfies never;
|
||||
@@ -107,11 +107,8 @@ function getShellInstructions(
|
||||
}
|
||||
}
|
||||
|
||||
function getFileInstructions(shell: ResolvedPayload["shell"]): string {
|
||||
if (shell === "disabled") {
|
||||
return `### File operations\n\nShell is disabled — you cannot read arbitrary files. Use the diff content returned by MCP tools directly.`;
|
||||
}
|
||||
return `### File operations\n\nUse the \`shell\` MCP tool for all file operations. Examples:\n- Read a file: \`shell({ command: 'cat /path/to/file', description: 'read file' })\`\n- Read specific lines: \`shell({ command: 'sed -n "<start>,<end>p" /path/to/file', description: 'read lines' })\`\n- Search in a file: \`shell({ command: 'grep -n "pattern" /path/to/file', description: 'search' })\``;
|
||||
function getFileInstructions(_shell: ResolvedPayload["shell"]): string {
|
||||
return `### File operations\n\nUse the \`read_file\` MCP tool to read files. For example: \`read_file({ path: diffPath, start_line: 5, end_line: 42 })\`. This is the primary way to read the PR diff returned by \`checkout_pr\`.`;
|
||||
}
|
||||
|
||||
function getStandaloneModeInstructions(
|
||||
|
||||
Reference in New Issue
Block a user