scaffold_api_contract_test
Generate API contract test code for Playwright, Jest, Vitest, or MSW to validate an API endpoint against a Zod schema.
Instructions
Generate an API contract test or mock boilerplate for Playwright, Jest, Vitest, or MSW. Use to answer: how do I write a test that validates this API endpoint against this schema?
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": {
"endpoint": "<endpoint>",
"schema_code": "<schema_code>"
},
"name": "scaffold_api_contract_test"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | HTTP method | GET |
| base_url | No | Base URL of the API | http://localhost:3000 |
| endpoint | Yes | API endpoint path (e.g., /api/users) | |
| framework | No | Testing framework to generate code for | playwright |
| test_name | No | Name of the generated test | API Contract Validation |
| schema_code | Yes | Zod schema code for the response body |