Skip to content

fix(mcp): Allow several tool groups in btw_mcp_server() - #221

Open
taekop wants to merge 1 commit into
posit-dev:mainfrom
taekop:fix/mcp-server-multiple-tools
Open

taekop wants to merge 1 commit into
posit-dev:mainfrom
taekop:fix/mcp-server-multiple-tools

Conversation

@taekop

@taekop taekop commented Sep 25, 2026

Copy link
Copy Markdown

Fixes #206

Summary

btw_mcp_server() checks whether tools is a path to an R file with is.character(tools) && file.exists(tools) && .... When tools names more than one tool group, e.g. btw_mcp_server(c("docs", "env", "sessioninfo")), file.exists() returns a vector and && errors under R >= 4.3, so the server fails on startup. This swaps is.character() for is_string(), so the file branch only applies to a single path.

Verification

devtools::test(filter = "mcp")

The new test in test-mcp.R calls btw_mcp_server(tools = c("docs", "env")) with mcptools::mcp_server() mocked. It errors on main with 'length = 2' in coercion to 'logical(1)' and passes with this change.

The R file detection chained `is.character(tools) && file.exists(tools)`,
which errors under R >= 4.3 when `tools` names more than one tool group.
Use `is_string()` so the file branch only considers a single path.

Fixes posit-dev#206
@taekop
taekop force-pushed the fix/mcp-server-multiple-tools branch from e294d1e to 76c7dec Compare September 25, 2026 15:59

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

btw_mcp_server() errors at startup when tools is a character vector of length > 1

1 participant