softwaremill / softwaremill/chimp

T15 - client MRTR (multi round trip request) retry loop

Open
#253 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

2026-07-28 version support
Dominant language
Scala
Stars
102
Forks
10
Avg merge
1d 2h
Merged PRs (30d)
16

Description

Target branch: 2026-07-28-protocol-support

Requires:

A chimp client completes a tools/call, prompts/get or resources/read that a 2026-07-28 server answers with an input-required result. The client gathers the requested input through its handlers and retries the request, as many rounds as the server needs. The caller sees one call and one final result.

Handlers

  • The roots, sampling and elicitation handlers can be given to any client, over any transport. A bidirectional transport is needed only for legacy servers that send requests themselves.
  • The capabilities the client declares on every request reflect the handlers it has. A server may therefore only ask for input the client can produce.

The retry loop

  • When a result has resultType: input_required, the client answers every entry of inputRequests with the handler for its kind, then sends the original request again with all answers in inputResponses, under the same keys.
  • The retry carries requestState byte for byte as the server sent it. When the server sent none, the retry carries none. The client never inspects or changes the state.
  • The retry is a new request with a new id and its own request metadata.
  • An input-required result without inputRequests leads to a retry with the state only.
  • The loop continues while the server keeps asking, up to a bounded number of rounds. At the bound the call fails with McpProtocolException.
  • A result without resultType is complete and ends the call. No retry happens.

Failures

  • An input request of a kind the client has no handler for fails the call with McpProtocolException. Nothing is retried.
  • A handler that fails or refuses ends the call with that failure. A handler that answers with decline or cancel produces a normal answer, and the server decides what happens next.
  • An input-required result on any operation other than the three named above fails the call with McpProtocolException, because the spec forbids it.

Coverage

  • The rules above hold for the sync and streaming clients, over HTTP and stdio, on ZIO, Ox and Pekko.
  • Behaviour towards legacy servers does not change.
  • The conformance client handles the sep-2322-client-request-state scenario, which calls test_mrtr_echo_state, test_mrtr_unrelated, test_mrtr_no_state and test_mrtr_no_result_type.

Spec:

Conformance scenarios that must pass after this task (2026-07-28 run):

  • Client: sep-2322-client-request-state.

Docs: yes.

  • docs/client/capabilities.md: the handlers work over every transport with a 2026-07-28 server, a bidirectional transport is needed only for legacy servers, how the retry loop behaves and where its bound is set. Updated McpClient.apply and bidirectional snippets.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the sync and streaming client request-handling entry points across HTTP and stdio on ZIO, Ox and Pekko; the payload does not name implementation files. Run the Client conformance scenario sep-2322-client-request-state, including its listed test methods, and verify the retry, state, handler-failure and bound rules. Update docs/client/capabilities.md with the requested transport, retry-bound and snippet documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, documentation, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.