Skip to content

feat(mcp): implement F-mcp-agent-loop prompt_in_session tool (#196) - #319

Merged
bastien-gallay merged 2 commits into
mainfrom
feat/f-mcp-agent-loop
Sep 22, 2026
Merged

bastien-gallay merged 2 commits into
mainfrom
feat/f-mcp-agent-loop

Conversation

@bastien-gallay

Copy link
Copy Markdown
Collaborator

Summary

Implements F-mcp-agent-loop (#196): the composed agent-loop MCP tool prompt_in_session, combining run_in_session (text input), wait_for_status (synchronisation), and read_terminal (observation) into a single MCP round trip.

Changes

  • crates/app/src/mcp/handler.rs:
    • Implemented prompt_in_session tool method and PromptInSessionArgs struct.
    • Added bounded step-by-step execution (CALL_TIMEOUT, wait_timeout, READ_BACK_TIMEOUT).
    • Implemented opt-in check for nested Claude sessions (SessionKind::Claude).
    • Added unit tests (prompt_in_session_happy_path_for_shell_session, prompt_in_session_rejects_nested_claude_without_opt_in, prompt_in_session_allows_nested_claude_with_per_call_opt_in).
    • Updated the sweep_case integration test sweep for structured content response verification.
  • crates/app/src/settings.rs:
    • Added McpSettings with allow_claude_nesting: bool (default false).
    • Added unit tests for McpSettings default and JSON deserialisation.
  • Roadmap:
    • Updated .roadmap/features/f-mcp-agent-loop.md status to done and regenerated ROADMAP.md via just roadmap.

Closes #196

Add the composed agent-loop MCP tool `prompt_in_session` which combines run_in_session, wait_for_status, and read_terminal into a single round trip.

- Add `prompt_in_session` tool to `TermherdMcp` in `crates/app/src/mcp/handler.rs`.
- Add `McpSettings` with `allow_claude_nesting` (default false) to `Settings` in `crates/app/src/settings.rs`.
- Shell sessions are allowed by default; nested Claude sessions require opt-in.
- Update roadmap status for F-mcp-agent-loop (#196).

Closes #196
…mpt_in_session

Extract helper methods (fetch_session_info, wait_for_session_status, read_session_terminal, check_claude_nesting) to keep prompt_in_session under 40 lines and add unit tests targeting check_claude_nesting.
@bastien-gallay
bastien-gallay merged commit 4c8b5b5 into main Sep 22, 2026
20 checks passed
@bastien-gallay
bastien-gallay deleted the feat/f-mcp-agent-loop branch September 22, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F-mcp-agent-loop: composed prompt->wait->read over any session (shell or Claude)

1 participant