Repository navigation
Ask before MCP tools that aren't read-only under HITL; show MCP results readably - #152
Merged
Merged
Conversation
A successful MCP call reaches the turn as the SDK's TextContent and an error as the CallToolResult's JSON. The consecutive-failure warning quoted that JSON envelope verbatim, and the Ctrl+O viewer showed a server's JSON answer as one long line, which made a 1,000-row result unreadable. McpToolResult.Display reads every shape a result comes in, and the viewer indents an MCP server's JSON. A string result from fuseraft's own tools is left exactly as it is, so a JSON file a tool read still shows as it is on disk.
HITL gated shell commands, file writes, Git writes and write-ish HTTP calls, but an MCP server's tools ran without asking, whatever they did: a GitHub server's create_issue went through as freely as a read. Under HITL, a call to an MCP tool now asks first, showing its arguments, unless the server marks the tool read-only (readOnlyHint), as built-in read-only tools never ask. "Always" covers that one tool on that server and is saved for the directory, as it is for a Git or Http tool. A blocked call never reaches the server; the model gets [DENIED].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by testing sql-mcp and a small write-capable MCP server in the full-screen REPL.
Ask before an MCP tool that isn't read-only runs under HITL
HITL asked before shell commands, file writes, Git writes and write-ish HTTP calls, but MCP tools ran without asking, including write tools such as a GitHub server's
create_issue.Now, with HITL on, the REPL asks before a call to an MCP tool unless the server marks the tool read-only (
readOnlyHint). Built-in read-only tools already run without asking, so this matches them. The prompt shows the call's arguments:[DENIED].DelegatingAIFunction(ReplMcpApproval) wrapped around the tools at all three places a server connects: saved servers at startup,/mcp addand/mcp login.repl.md,cli-reference.mdandmcp.mddocs are updated.fuseraft run --hitlis unchanged: its MCP tools still run without asking.Show an MCP tool's text, not the SDK's wrapping of it
A successful MCP call reaches the turn as the SDK's
TextContent; an error arrives as theCallToolResultJSON. Two places showed that wrapping:McpToolResult.Displaynow handles every shape a result arrives in:TextContent, a list of contents, or the envelope JSON. Ctrl+O indents an MCP server's JSON. String results from fuseraft's own tools are left exactly as they are, so a JSON file the model read still appears as it is on disk.Testing
ReplMcpApprovalTestsuse a real in-process MCP server over pipes. They cover: a read-only tool runs without asking; another tool asks with its arguments and then runs; a blocked call never reaches the server; with HITL off, nothing is wrapped.McpToolResult.Displayand renderer tests./approvalsand/approvals clear, the indented Ctrl+O output, and the unwrapped warning.