MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / askApproval

Function askApproval

src/core/assistant-message/presentAssistantMessage.ts:186–220  ·  view source on GitHub ↗
(
				type: ClineAsk,
				partialMessage?: string,
				progressStatus?: ToolProgressStatus,
				isProtected?: boolean,
			)

Source from the content-addressed store, hash-verified

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

Callers 15

executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85
executeMethod · 0.85

Calls 3

pushToolResultFunction · 0.85
askMethod · 0.80
sayMethod · 0.80

Tested by

no test coverage detected