[Feature request] Handle prompts/list

Open
#59 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start in R/server.R at handle_message_from_client and compare the requested prompts/list flow with the MCP prompts specification and existing JSON-RPC handlers. Determine the supported prompt response for btw, then verify the server returns a valid response rather than -32601; no test file is named in the issue.

Written by the indexing model from the issue text.

Description

Thanks for this work, I'm grateful for it

Background

My AI IDE calls a prompts/list method when setting itself up as an MCP client.

When I try running btw_mcp_server under MCP, I'm thrown an Error listing offerings: MCP error -32601: Method not found. Config looks like:

    "r-btw-docs": {
      "command": "Rscript",
      "args": ["-e", "btw::btw_mcp_server()"],
      "cwd": "/..../path/to/relevant/renv",
      "env": {
        "MCPTOOLS_SERVER_LOG": "/path/to/logs/btw_server.log"
      }
    }

Looking at mcptools logs, I see FROM CLIENT: {"method":"prompts/list","jsonrpc":"2.0","id":2}, which doesn't seem implemented yet in handle_message_from_client.

prompts/list is included in MCP, as you'll see here

Expectation

I don't expect to get a -32601 when I use btw

Possible Solution

I'm happy to put in a PR but didn't want to assume this solution is acceptable. I've written a placeholder for my own use:

diff --git a/R/server.R b/R/server.R
index 5977e93..25bd786 100644
--- a/R/server.R
+++ b/R/server.R
@@ -174,6 +174,15 @@ handle_message_from_client <- function(line) {
       )
     )
 
+    cat_json(res)
+  } else if (data$method == "prompts/list") {
+    res <- jsonrpc_response(
+      data$id,
+      list(
+        prompts = list()
+      )
+    )
+
     cat_json(res)
   } else if (data$method == "tools/call") {
     tool_name <- data$params$name

However, I'm just using list() isn't very satisfying an implementation.

I'm happy to put in a PR for the above or work on something if you have a preference for how to handle prompts

Dominant language
R
Stars
207
Forks
24
Avg merge
36m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from posit-dev/mcptools

All issues in posit-dev/mcptools

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.