| mcp_call_active | R Documentation |
MCP tool call is runningReturns TRUE while a tool runs for an MCP request, and
FALSE otherwise, for example when the in-dashboard chat calls the
same tool. While it is TRUE, the environment variable
SHIDASHI_USING_MCP is set to "TRUE", so code that cannot
call this function, such as skill scripts running in their own process,
can check the variable instead.
mcp_call_active(v)
v |
optional logical; when given, turns the state on ( |
The dashboard's MCP handler turns the state on before each tool
call and off when the call returns, also when the tool fails. A tool
that returns a promise returns before the promise settles, so code that
runs once it settles sees FALSE.
TRUE or FALSE: the state after any change.
# Outside of an MCP tool call
mcp_call_active()
Sys.getenv("SHIDASHI_USING_MCP")
# In a tool: print less when an agent calls it over MCP
summarize_values <- function(x) {
if (!mcp_call_active()) {
message("Summarizing ", length(x), " values")
}
summary(x)
}
summarize_values(1:10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.