Skip to main content
Glama
r-packagedev-mcp

r-packagedev-mcp

by B0ydT

use_test

Creates a matching testthat test file under tests/testthat/ for a specified function or module, automatically configuring testthat when needed.

Instructions

Create a matching test file under tests/testthat/ for a given function or module using usethis::use_test(). Automatically sets up testthat if not already configured.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>",
      "project_path": "<project_path>"
    },
    "name": "use_test"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesName of the function or module to create a test file for.
project_pathYesAbsolute path to the root of the R package.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It does disclose one meaningful side effect — it bootstraps testthat configuration if absent — which an agent could not infer from the name. However, it says nothing about overwriting an existing test file, where the file is written relative to project_path, or whether the user's editor is touched.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences, front-loaded with the action and target location, then the conditional side effect. No filler or restated title.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter scaffolding tool with a fully described schema and no output schema, this covers what the tool produces and its configuration side effect. The remaining gap is overwrite/idempotency behavior when the test file already exists.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so both parameters are already documented as the function/module name and the absolute package root. The description adds only mild context ('for a given function or module', output location under tests/testthat/), which is close to baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Create a matching test file under tests/testthat/') and even names the underlying usethis call, so the agent knows exactly what artifact appears. It implicitly separates itself from siblings like test_file/test_dir that run tests rather than scaffold them, but never says so explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: create a test when you have a function/module that needs one. There is no explicit 'use this before test_file', no mention of the relationship to use_testthat, and no prerequisites such as requiring an existing R package root.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.