mcp_server() gathers the tools, resources and prompts of a server
written in an R script rather than in a package, which
run_mcp_server() serves when it gets the path of the script. Each of
them is a function declared with mcp_tool(), mcp_resource() or
mcp_prompt(), with the roxygen tags a package would use, written as
text: @mcpType, @mcpReturns, @mcpTask, @mcpConfirm... The
same checks as the roclet apply, so a declaration that the roclet
refuses stops with the same error.
Usage
mcp_server(
name,
version,
instructions,
tools = list(),
resources = list(),
prompts = list(),
title = NULL,
description = NULL,
website_url = NULL,
icons = character(),
skills = NULL
)
mcp_tool(
name,
fun,
title,
description,
params = character(),
tags = character()
)
mcp_resource(
name,
uri,
fun,
title,
description,
params = character(),
tags = character()
)
mcp_prompt(
name,
fun,
title,
description,
params = character(),
tags = character()
)Arguments
- name
The name of the server, of the tool, of the resource or of the prompt.
- version
The version of the server.
- instructions
What the server does, and when the model should use its tools.
- tools, resources, prompts
Lists of tools, resources and prompts made by
mcp_tool(),mcp_resource()andmcp_prompt().- title, description
The title and the description: of the server, which clients may show, as a package takes them from the
TitleandDescriptionof its DESCRIPTION; of a tool, a resource or a prompt, as the first lines of its roxygen block.- website_url
The website of the server, which clients may show. A package takes the first
URLof its DESCRIPTION.- icons
The icons of the server, each written as an
@mcpIcontag without the tag: the URI, thenmimeType=,sizes=andtheme=. A package takes them from the@mcpIcontags of the roxygen block that documents"_PACKAGE".- skills
The folder of the skills of the server, relative to the script: one folder with a
SKILL.mdper skill. A package serves those ofinst/mordew/skills/.- fun
The function that runs the tool, reads the resource or gets the prompt.
- params
The descriptions of the arguments of
fun, named, as@paramtags.Other roxygen tags, each a string that starts with
@.- uri
The URI of the resource, or its URI template.