fix: reviews failing to call next tool

This commit is contained in:
2026-05-31 11:52:45 -05:00
parent 0cf9df2bb6
commit fe85adfa53
3 changed files with 42 additions and 8 deletions
+6 -3
View File
@@ -107,8 +107,11 @@ function getShellInstructions(
}
}
function getFileInstructions(): string {
return `### File operations\n\nUse your native file read/write/edit tools for all file operations.`;
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 getStandaloneModeInstructions(
@@ -241,7 +244,7 @@ Use MCP tools from ${shockbotMcpName} for all Gitea operations. Never use the \`
${getShellInstructions(ctx.payload.shell, t)}
${getFileInstructions()}
${getFileInstructions(ctx.payload.shell)}
${getStandaloneModeInstructions(ctx.payload.event.trigger, t, ctx.outputSchema)}