[Feature request] Handle prompts/list

未关闭
#59 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
r
领域
api

调研方向

从 R/server.R 中的 handle_message_from_client 开始,将请求的 prompts/list 流程与 MCP prompts 规范及现有的 JSON-RPC 处理器进行比较。确定 btw 支持的 prompt 响应,然后验证服务器返回的是有效响应而不是 -32601;issue 中未指定测试文件。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
R
星标
207
派生
24
平均合并
36 分钟
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

posit-dev/mcptools 的其他 Issue

查看 posit-dev/mcptools 的全部 Issue

相似的 Issue

更多 R Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。