posit-dev / posit-dev/positron
Assistant: Provide a way for R packages to register language model tools
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 195
Description
The tools btw and acquaint separate the concepts of "LLM tools" (btw) and "an MCP server that provides the tools to an LLM" (aquaint).
Positron's built-in tool calls for R are always going to be limited (and probably outdated) compared to what third parties can build for their own packages. We can empower the community (and the R team here) to build very rich tooling that we don't have the capacity to build in the Positron core. What if we built a way for R packages to register LLM tools directly via something like rstudioapi? It would work something like this:
sequenceDiagram
R Package ->> R Kernel: rstudioapi::registerLanguageModelTool
R Kernel ->> R Extension: RegisterTool comm message
R Extension ->> Positron: vscode.lm.registerTool
Positron ->> R Extension: Invoke Tool
R Extension ->> R Kernel: InvokeTool comm message
R Kernel ->> R Package: Run callback
R Package ->> R Kernel: Callback result
R Kernel ->> R Extension: ToolResult comm message
R Extension ->> Positron: Callback result
Some implementation notes:
- Lifecycle management needed; tools would need to be re-registered after an extension host restart, on reload, unregistered when session ends, etc. On a reload, how would we remember what tools were registered and now need re-registration? Could be the responsibility of the extension, or we could maintain a list on the Positron side.
- Care is needed to avoid multiple R sessions registering multiple instances of the same tool. We would probably want a Positron API that looks like
vscode.lm.registerToolbut registers a session-scoped tool that is used only when the given session is focused/active.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by tracing the R package, R Kernel, R Extension, and Positron message flow around rstudioapi and vscode.lm; completion should cover registration, invocation, session scoping, and behavior across extension restarts, reloads, and session ends.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r, typescript, vscode
- Domain
- ai, developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100