posit-dev / posit-dev/mcptools

don't automatically dispatch to a busy session

Open
#63 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
196
Forks
21
Avg merge
1h 14m
Merged PRs (30d)
1

Description

I just ran into a (simplified) situation where I had 2 R sessions running, both configured with mcp_session() via .Rprofile.

  • Session 1), the first one to be connected with mcp_session(), is running long-running code and has been / will be busy for hours
  • Session 2) is mostly idle

If I explicitly ask to list_r_sessions() and then select 2), the server runs fine. Otherwise, the request is automatically dispatched to 1), where it fails.

Notably, when I list_r_sessions(), 1) doesn't even show up—this makes sense to me and doesn't require any changes—but I think our default session should change from:

  • Before: The lowest-numbered session (or the server itself if there is none), to
  • After: The lowest-numbered session that is actually responsive, e.g. the smallest index that would appear in list_r_session() if called (or the server itself if there is none)

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 by tracing the default dispatch behavior from mcp_session() and compare it with the responsive-session filtering used by list_r_sessions(). Done means requests choose the lowest-numbered responsive session, while retaining the server fallback when no such session exists; verify both busy and idle R sessions.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
backend, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.