Skip to main content
Glama
SmartBear

SmartBear MCP server

Official
by SmartBear

Contract Testing: Generate Pact Tests

contract-testing_generate_pact_tests
Read-onlyIdempotent

Generate Pact contract tests from API request/response pairs, source code, or OpenAPI specs. AI analyzes inputs to produce consumer-driven contract tests for reliable API integration.

Instructions

Generate Pact tests using PactFlow AI. You can provide one or more of the following input types: (1) request/response pairs for specific interactions, (2) code files to analyze and extract interactions from, and/or (3) OpenAPI document to generate tests for specific endpoints. When providing an OpenAPI document, a matcher is required to specify which endpoints to generate tests for.

Toolset: Generate Pact Tests

Parameters:

  • language (enum): Target language for the generated Pact tests. If not provided, will be inferred from other inputs.

  • requestResponse (object): Direct request/response pair for a specific interaction. Use this when you have concrete examples of API requests and responses

  • code (array): Collection of source code files to analyze and extract API interactions from. Include client code, data models, existing tests, or any code that makes API calls

  • openapi (any)

  • additionalInstructions (string): Optional free-form instructions to guide the generation process (e.g., 'Focus on error scenarios', 'Include authentication headers', 'Use specific test framework patterns')

  • testTemplate (object): Optional test template to use as a basis for generation. Helps ensure generated tests follow your specific patterns, frameworks, and coding standards

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoCollection of source code files to analyze and extract API interactions from. Include client code, data models, existing tests, or any code that makes API calls
openapiNoIf provided, the OpenAPI document which describes the API being tested and is accompanied by a matcher which will be used to identify the interactions in the OpenAPI document which are relevant to the Pact refinement process.
languageNoTarget language for the generated Pact tests. If not provided, will be inferred from other inputs.
testTemplateNoOptional test template to use as a basis for generation. Helps ensure generated tests follow your specific patterns, frameworks, and coding standards
requestResponseNoDirect request/response pair for a specific interaction. Use this when you have concrete examples of API requests and responses
additionalInstructionsNoOptional free-form instructions to guide the generation process (e.g., 'Focus on error scenarios', 'Include authentication headers', 'Use specific test framework patterns')
Behavior3/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true, so the description's mention of using PactFlow AI for generation adds minimal behavioral context. No side effects or limitations are disclosed beyond annotations.

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

Conciseness3/5

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

The description is front-loaded with the main purpose but includes a long list of parameter descriptions. While structured, it could be more concise by reducing redundancy (e.g., repeated 'Description' text from schema).

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

Completeness2/5

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

No output schema is provided, and the description does not explain what the tool returns (e.g., generated test files, a status). Given the complexity and lack of output schema, this is a significant gap for an agent to understand the tool's outcome.

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?

Schema coverage is 100%, but the description adds meaningful context for several parameters (e.g., 'Include client code, data models, existing tests' for code, 'Required: matcher' for openapi). This enriches the schema's bare descriptions.

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

Purpose5/5

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

The description starts with a clear verb 'Generate Pact tests' and identifies three distinct input types (request/response pairs, code files, OpenAPI document). It distinguishes itself from sibling contract-testing tools by focusing on test generation using PactFlow AI.

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

Usage Guidelines4/5

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

The description explains when to use each input type (e.g., 'Use this when you have concrete examples' for requestResponse, mentions matcher requirement for OpenAPI). However, it doesn't explicitly contrast with alternatives like review_pact_tests or other generation tools.

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/SmartBear/smartbear-mcp'

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