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 tests from request/response pairs, source code, or OpenAPI documents, using PactFlow AI to create contract tests for specified endpoints.

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')
Install Server

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, so the safety profile is covered. The description adds useful input-related context: language inference ('If not provided, will be inferred from other inputs') and the OpenAPI matcher requirement. However, it does not disclose what generation returns or whether any state is persisted, leaving behavioral transparency partial.

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

Conciseness2/5

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

The opening paragraph is concise and useful, but the description then includes a full 'Parameters:' section that duplicates the schema almost verbatim. The 'Toolset: Generate Pact Tests' heading is redundant. Much of the added length does not earn its place in an MCP description that is meant to complement, not repeat, structured schema fields.

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?

The description handles the complex input surface well: three input modes, the OpenAPI matcher requirement, and the distinction between inline and remote OpenAPI documents. However, with no output schema, the description does not state what a successful generation returns or how an agent should consume the result. This is a clear gap for such a complex tool.

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 the baseline is 3. The description mostly restates parameter meanings that already appear in the schema (e.g., additionalInstructions, testTemplate, code). It adds little semantic value beyond mapping the three top-level input modes to parameter names. The matcher requirement is also already documented in the schema.

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 opens with a specific verb and resource: 'Generate Pact tests using PactFlow AI.' It enumerates the three accepted input types, making the tool's purpose unmistakable. It is also clearly distinguished from the adjacent sibling contract-testing_review_pact_tests by the generate action.

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 that one or more input types may be supplied and states a hard prerequisite: 'When providing an OpenAPI document, a matcher is required.' It also gives scenario guidance for requestResponse ('Use this when you have concrete examples of API requests and responses'). It does not explicitly contrast with alternatives like review_pact_tests, but the intended usage context is largely clear.

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

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