Skip to main content
Glama
SmartBear MCP server

SmartBear MCP server

Official
by SmartBear

Contract Testing: Generate Pact Tests

contract-testing_generate_pact_tests
Read-onlyIdempotent

Create Pact contract tests from request/response examples, source code, or selected OpenAPI endpoints; set target language and test template.

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

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

Output Schema

NameRequiredDescriptionDefault
idNo
codeNo
promptNo
languageNo
instructionsNo
requiresPromptExecutionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.43.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": {},
      +  "properties": {
      +    "code": {
      +      "type": "string"
      +    },
      +    "id": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "instructions": {
      +      "type": "string"
      +    },
      +    "language": {
      +      "type": "string"
      +    },
      +    "prompt": {
      +      "type": "string"
      +    },
      +    "requiresPromptExecution": {
      +      "const": true,
      +      "type": "boolean"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Addedv0.40.0
  3. Removedv0.34.0
  4. First observedv0.27.1

TDQS

A3.6/5.0
Behavior3/5

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

The annotations already declare readOnlyHint=true, idempotentHint=true, openWorldHint=false, and destructiveHint=false. The description adds useful context about PactFlow AI generation and OpenAPI matcher requirements, but it says nothing about entitlements, authentication, rate limits, or non-obvious generation behavior.

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 opening sentences are front-loaded and useful, but the definition then repeats a long parameter list almost verbatim from the schema. The **Toolset** and **Parameters** headings add little value and make the description longer than necessary.

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

Completeness4/5

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

For a complex nested tool with an output schema and rich annotations, the description covers the main input combinations and the OpenAPI matcher requirement. The remaining gap is that it does not relate this tool to the nearby review or entitlement-checking tools.

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 schema already documents parameter meaning in detail. The description’s parameter list mostly restates those schema descriptions and adds only the high-level input-mode explanation.

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 states a specific verb and resource: 'Generate Pact tests using PactFlow AI', and enumerates the three supported input modes. It is not explicitly differentiated from the sibling contract-testing_review_pact_tests, which limits the top score.

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?

It clearly explains that one or more input types can be supplied and that a matcher is required when an OpenAPI document is used. It does not explicitly say when to use this tool instead of contract-testing_review_pact_tests or contract-testing_check_pactflow_ai_entitlements.

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

Deploy Server

Other Tools