Skip to main content
Glama

contract

Prevent backend API drift by generating consumer contracts from actual API responses. Manage contract baselines with save, load, compare, list, and delete operations.

Instructions

API 契约工具。v1.9.5 起合并 contract_guard / contract_baseline。mode=guard 从前端实际消费的 API 响应中自动提取字段结构,生成 consumer contract(消费者契约),防止后端 API 漂移;mode=baseline 进行契约基线管理(保存/加载/对比/列出/删除)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo工作模式:guard(生成/校验消费者契约,默认)、baseline(基线管理)guard
nameNo基线名称(仅 mode=baseline),默认 'default'
sinceNo从 network 日志提取的时间起点(仅 mode=guard),默认当前 checkpoint
actionNo基线操作类型(仅 mode=baseline):list=列出所有基线、save=保存当前 contracts 为基线、load=加载指定基线、compare=对比当前 contracts 与基线、delete=删除基线list
contractsNosave/compare 操作时传入的 contracts 列表(仅 mode=baseline),通常来自 contract_guard 的输出
endpointsNo要直接调用并生成契约的端点列表(仅 mode=guard),每项包含 path/url/method/headers/body
fromNetworkNo是否从已捕获的 network 日志中提取 API 响应生成契约(仅 mode=guard),默认 true
urlContainsNo只处理 URL 包含此字符串的请求(仅 mode=guard)
autoDiscoverNo是否自动从 network 日志发现 API 端点(仅 mode=guard),默认 false
baselineNameNo基线名称(仅 mode=guard),默认 'default'
saveBaselineNo是否将本次生成的 contracts 保存为基线(仅 mode=guard),默认 false
compareBaselineNo是否与已保存的基线对比(仅 mode=guard),默认 false
Behavior3/5

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

No annotations are provided, so the description carries full burden. It explains the two modes and their basic operations, but does not disclose what the tool returns, side effects, permissions, rate limits, or how the output looks. This is adequate but not comprehensive for a tool without annotations.

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

Conciseness5/5

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

The description is two concise sentences that front-load the core purpose and mode differentiation. Every sentence adds value without redundancy.

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?

Given the complexity (12 parameters, no output schema), the description covers the main modes but lacks details on output format, return values, or step-by-step usage guidance. It is minimally complete but could be more helpful.

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 coverage is 100% with descriptions for all 12 parameters. The tool description adds overall context about merging and modes, but does not significantly enhance understanding beyond the schema. Baseline of 3 is appropriate.

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 clearly states the tool is an API contract tool merged from contract_guard and contract_baseline, and explains two distinct modes (guard and baseline) with specific actions. This distinguishes it from sibling tools like contract_baseline and contract_guard.

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 provides clear context for when to use each mode (guard for generating consumer contracts from actual API responses, baseline for managing baselines) and lists baseline actions (list/save/load/compare/delete). However, it does not explicitly state when not to use the tool or suggest alternatives.

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/validpilot/ai-verify-mcp'

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