Skip to main content
Glama

run_tests

Execute standardized project tests with coverage when no specific pattern is provided, ensuring code quality through automated validation.

Instructions

Run standardized tests for the project (with coverage when no pattern specified)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternNoTest file pattern to match (runs coverage mode if omitted)

Implementation Reference

  • The RunTestsTool class extends BaseExecTool and defines the core logic for building the shell command to run tests, either with coverage (no pattern) or matching a specific pattern using the project's test command.
    class RunTestsTool extends BaseExecTool<TestRunnerOptions> {
      protected getActionName(): string {
        return 'Test';
      }
    
      protected async buildCommand(args: TestRunnerOptions): Promise<string> {
        const { pattern } = args;
        const config = await loadProjectConfig();
        
        // If no pattern specified, run tests with coverage
        if (!pattern) {
          return 'npm run test:coverage';
        }
        
        // Otherwise run the configured test command with the pattern
        const command = config.testCommand ?? 'npm test';
        return `${command} ${pattern}`;
      }
    }
  • src/index.ts:71-80 (registration)
    Registers the 'run_tests' tool with the MCP server, providing description, Zod input schema, and the handler function that delegates to runTests.
    server.registerTool(
      'run_tests',
      {
        description: 'Run standardized tests for the project (with coverage when no pattern specified)',
        inputSchema: {
          pattern: z.string().optional().describe('Test file pattern to match (runs coverage mode if omitted)'),
        },
      },
      async (args) => runTests(args)
    );
  • TypeScript interface defining the input shape for TestRunnerOptions used by the run_tests tool.
    export interface TestRunnerOptions {
      pattern?: string;
    }
  • The exported runTests function instantiates the tool and executes it, serving as the direct handler called by the registration.
    const tool = new RunTestsTool();
    
    export async function runTests(args: TestRunnerOptions): Promise<CallToolResult> {
      return tool.execute(args);
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that coverage runs when no pattern is specified, which adds some context about default behavior. However, it doesn't describe critical aspects like whether this is a read-only or destructive operation, what permissions are required, how long tests might take, error handling, or output format. For a tool that executes tests (potentially with side effects), this is a significant gap.

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?

The description is extremely concise and front-loaded: a single sentence that directly states the purpose and key usage detail. Every word earns its place, with no redundancy or fluff. It efficiently communicates the core functionality and the pattern-coverage relationship.

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

Completeness3/5

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

Given the tool's complexity (executing tests, potentially with coverage), lack of annotations, and no output schema, the description is minimally adequate. It covers the basic purpose and parameter implication but misses details like what 'coverage' entails, how results are returned, error conditions, or side effects. For a test-running tool, users need more context about execution behavior and outputs.

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

Parameters4/5

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

The description adds meaningful semantics beyond the input schema. The schema has 100% coverage with one parameter ('pattern'), but the description explains the behavioral implication of omitting it: 'runs coverage mode if omitted'. This clarifies that the parameter is optional and affects the tool's mode, which isn't evident from the schema alone. With only one parameter and high schema coverage, the description compensates well.

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?

The description clearly states the tool's purpose: 'Run standardized tests for the project' with the specific verb 'Run' and resource 'standardized tests'. It distinguishes itself from sibling tools like 'run_linter' (code quality) and 'review_code' (code review). However, it doesn't explicitly differentiate from 'generate_spec' or 'review_spec' which might be related to testing workflows.

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?

The description provides implied usage guidance: it mentions coverage runs when no pattern is specified, suggesting this tool is for executing tests with optional filtering. However, it doesn't explicitly state when to use this versus alternatives like 'run_linter' for code quality checks or 'review_code' for manual inspection, nor does it mention prerequisites or exclusions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jaggederest/mcp_reviewer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server