| 184 | const toolDescription = () => `[mcp_tool: ${mcpBlock.serverName}/${mcpBlock.toolName}]` |
| 185 | |
| 186 | const askApproval = async ( |
| 187 | type: ClineAsk, |
| 188 | partialMessage?: string, |
| 189 | progressStatus?: ToolProgressStatus, |
| 190 | isProtected?: boolean, |
| 191 | ) => { |
| 192 | const { response, text, images } = await cline.ask( |
| 193 | type, |
| 194 | partialMessage, |
| 195 | false, |
| 196 | progressStatus, |
| 197 | isProtected || false, |
| 198 | ) |
| 199 | |
| 200 | if (response !== "yesButtonClicked") { |
| 201 | if (text) { |
| 202 | await cline.say("user_feedback", text, images) |
| 203 | pushToolResult(formatResponse.toolResult(formatResponse.toolDeniedWithFeedback(text), images)) |
| 204 | } else { |
| 205 | pushToolResult(formatResponse.toolDenied()) |
| 206 | } |
| 207 | cline.didRejectTool = true |
| 208 | return false |
| 209 | } |
| 210 | |
| 211 | // Store approval feedback to be merged into tool result (GitHub #10465) |
| 212 | // Don't push it as a separate tool_result here - that would create duplicates. |
| 213 | // The tool will call pushToolResult, which will merge the feedback into the actual result. |
| 214 | if (text) { |
| 215 | await cline.say("user_feedback", text, images) |
| 216 | approvalFeedback = { text, images } |
| 217 | } |
| 218 | |
| 219 | return true |
| 220 | } |
| 221 | |
| 222 | const handleError = async (action: string, error: Error) => { |
| 223 | // Silently ignore AskIgnoredError - this is an internal control flow |