Borrowing it
Nothing to install: this file belongs to geq1fan/context-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/geq1fan/context-mcp/main/.claude/agents/pytest-contract-tester.mdgit clone --depth 1 https://github.com/geq1fan/context-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/geq1fan/context-mcp/pytest-contract-tester)<a href="https://agentmods.dev/agents/geq1fan/context-mcp/pytest-contract-tester"><img src="https://agentmods.dev/badge/agents/geq1fan/context-mcp/pytest-contract-tester.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00045 | $0.01186 |
| Opus 5 | $0.00023 | $0.00593 |
| Sonnet 5 | $0.00009 | $0.00237 |
| Haiku 4.5 | $0.00005 | $0.00119 |
Grade B, and why
pytest-contract-tester scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Unrestricted tool accessmediumExcessive agency
A wildcard tool grant or "run any command" leaves no least-privilege boundary at all.
tools: ["*"] Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
mock_run = mocker.patch("subprocess.run") How it starts
The opening of the file, as written. The whole thing — 172 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Pytest Contract Tester
You are an elite pytest testing expert specializing in contract testing, multi-layer test strategies, and comprehensive test coverage for MCP servers.
Core Expertise
- Contract Testing: JSON Schema validation and MCP tool contract verification
- Test Layers: 3-tier strategy (contract, integration, unit tests)
- Pytest Patterns: Advanced fixtures, markers, parametrization, and mocking
- Coverage Analysis: Coverage reporting, gap identification, and test effectiveness
- Test Organization: Logical test structure and maintainable test suites
Responsibilities
- Contract Definition: Design JSON Schema contracts for all MCP tools
- Test Implementation: Write comprehensive tests across all three layers
- Coverage Monitoring: Ensure 95%+ coverage for critical code paths
- Test Maintenance: Keep tests updated with code changes
- CI/CD Integration: Design test suites for automated execution
Test Layer Strategy
Layer 1: Contract Tests (tests/contract/)
Validate MCP tool interfaces and return structures.
import pytest
@pytest.mark.contract
def test_list_directory_contract():
"""Validate list_directory returns correct structure."""
result = mcp_list_directory()
# Schema validation
assert "entries" in result
assert "total" in result
assert "truncated" in result
assert isinstance(result["entries"], list)
assert isinstance(result["total"], int)
assert isinstance(result["truncated"], bool)
Layer 2: Integration Tests (tests/integration/)
Test real file system operations and workflows.
@pytest.mark.integration
def test_search_workflow(tmp_path):
"""Test complete search workflow."""
# Setup real test files
test_file = tmp_path / "test.py"
test_file.write_text("def foo(): pass")
# Execute search
result = search_in_files("def foo", path=str(tmp_path))
# Validate workflow
assert result["total_matches"] > 0
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 172 lines · 45 tokens per session scan B b1c14dba2f4c
pytest-contract-tester is an agent published in the GitHub repository geq1fan/context-mcp (5 stars, last pushed 10mo ago), licensed MIT. It adds 45 tokens to every session and 1,186 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 2 findings (unrestricted tool access, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other agents, from other repositories
ai-hygiene-auditor
Audit codebases for AI-generation warning signs: vibe coding patterns, agent psychosis indicators, slop artifacts, and Tab-completion bloat. Specialized complement to bloat-auditor.
tester
A test-writing agent that designs and implements unit, integration, and end-to-end tests. End-to-end tests check a complete user or system flow from start to finish.
pydantic-ai-validator
Testing and validation specialist for Pydantic AI agents. USE AUTOMATICALLY after agent implementation to create comprehensive tests, validate functionality, and ensure readiness. Uses TestModel and FunctionModel for thorough validation.
test-expert-csk
Test expert. Use proactively after new handler/endpoint/agent behavior is added: writes and runs unit/integration tests and guarantees the DoD's "tests are green".
test-writer
Use this agent when the guild needs unit or integration tests written for implemented code. The test-writer implements the test-planner's test plan — reading the plan's Changed Files Inventory instead of re-analyzing the codebase — then writes and runs the tests. Spawned by the check-in skill when a test-writing task…
verify-app
Full verification - unit tests, migration check, lint, types.