@debugg-ai/debugg-ai-mcp
Version:
Zero-Config, Fully AI-Managed End-to-End Testing for all code gen platforms.
42 lines (41 loc) • 2.65 kB
JavaScript
import { TestCaseInputSchema } from '../types/index.js';
import { testCaseHandler } from '../handlers/testCaseHandler.js';
import { DESTRUCTIVE } from './annotations.js';
const DESCRIPTION = `Manage individual test cases within a suite. Pass an "action":
- "create" {name, description, agentTaskDescription, suiteUuid|(suiteName+project), relativeUrl?, maxSteps?} → add a test case (NOT auto-run).
- "update" {testUuid, name?, description?, agentTaskDescription?} → patch a test case.
- "delete" {testUuid, confirm?} → soft-delete (DESTRUCTIVE; requires confirmation).`;
export function buildTestCaseTool() {
return {
name: 'test_case',
title: 'Test Case',
annotations: DESTRUCTIVE,
description: DESCRIPTION,
inputSchema: {
type: 'object',
properties: {
action: { type: 'string', enum: ['create', 'update', 'delete'], description: 'Operation to perform.' },
testUuid: { type: 'string', description: '[update/delete] Test case UUID.' },
name: { type: 'string', description: 'Test case name.' },
description: { type: 'string', description: 'Test case description.' },
agentTaskDescription: { type: 'string', description: "What the AI agent should do and verify." },
suiteUuid: { type: 'string', description: '[create] Suite UUID.' },
suiteName: { type: 'string', description: '[create] Suite name (requires a project identifier).' },
projectUuid: { type: 'string', description: '[create] Project UUID (or projectName).' },
projectName: { type: 'string', description: '[create] Project name (or projectUuid).' },
relativeUrl: { type: 'string', description: '[create] Starting path, must start with "/".' },
maxSteps: { type: 'number', description: '[create] Max agent steps (1..100).' },
confirm: { type: 'boolean', description: '[delete] Set true to confirm deletion (when the client cannot prompt).' },
},
required: ['action'],
// No top-level oneOf/anyOf/allOf: the Anthropic tool input_schema rejects
// them and clients (Claude Code) silently drop the tool. Per-action required
// fields are enforced by the Zod discriminated union in types/index.ts and
// documented in DESCRIPTION above.
additionalProperties: false,
},
};
}
export function buildValidatedTestCaseTool() {
return { ...buildTestCaseTool(), inputSchema: TestCaseInputSchema, handler: testCaseHandler };
}