MCP Resources
The Invarium MCP server exposes four read-only resources via the MCP protocol. These resources provide templates, prompt guides, and code that MCP clients can read to support the agent testing workflow.
Resources are accessed using invarium:// URIs. Your MCP client reads them automatically when the server instructions reference them, or you can request them explicitly.
How Resources Work
MCP resources are read-only data that the server makes available to clients. Unlike tools (which perform actions), resources simply return content — a JSON template, a markdown guide, or a Python file.
When the Invarium MCP server instructions tell the client to “read the invarium://templates/trace-prompt resource,” the client fetches that resource’s content and uses it to guide the next step.
Available Resources
invarium://templates/agent-blueprint
| Field | Value |
|---|---|
| URI | invarium://templates/agent-blueprint |
| MIME type | text/yaml |
| Purpose | YAML template for describing an AI agent |
The agent blueprint template is a structured YAML document that defines the schema for registering an agent with Invarium. It includes placeholders for all required and optional fields.
Contents:
The template defines the following top-level sections:
| Section | Description |
|---|---|
agent_name | The agent’s identifier (kebab-case). |
framework | The AI framework used (e.g., langchain, crewai, openai). |
description | A one-sentence summary of what the agent does. |
tools | Array of tool definitions, each with name, description, parameters (JSON Schema), returns, side_effects, requires_confirmation, and error_handling. |
workflow | Execution flow with an entry_point and chains (named sequences of tool invocations with trigger conditions). |
constraints | Behavioral rules including system_prompt_summary, guardrails, rate_limits, and max_retries. |
graph | Agent Intelligence Graph with nodes (Chain, Tool, Guard, ExternalService, PolicyConstraint) and edges (CAN_INVOKE, CHAINS_TO, GUARDED_BY, READS, WRITES). |
metadata | Generation metadata: generated_by, generated_at, confidence (high/medium/low). |
When it is used:
The MCP server reads this resource during Phase 1 (Agent Registration) to provide the blueprint structure. The client fills in the template by analyzing the agent’s codebase, then passes it to invarium_prepare_blueprint for validation.
See Blueprint Schema for the full field reference.
invarium://templates/blueprint-prompt
| Field | Value |
|---|---|
| URI | invarium://templates/blueprint-prompt |
| MIME type | text/markdown |
| Purpose | Step-by-step instructions for generating an agent blueprint from source code |
The blueprint prompt is a markdown guide that instructs the MCP client on how to analyze an AI agent’s codebase and produce a valid blueprint YAML.
Contents:
The prompt walks through seven steps:
| Step | Description |
|---|---|
| Step 1: Identify the Agent Framework | Scan imports for LangChain, CrewAI, AutoGen, OpenAI Agents SDK, OpenAI SDK (custom), or custom patterns. |
| Step 2: Extract Tools | Find all tool definitions across framework-specific patterns (@tool decorators, StructuredTool, function calling schemas, @function_tool). Extract name, description, parameters, returns, side effects, confirmation requirements, and error handling. |
| Step 3: Map Workflow | Trace execution flow from entry point through chains, routers, conditional branches, loops, and parallel execution. |
| Step 4: Detect Constraints | Identify system prompt instructions, guardrails (input/output validation, permission checks, content moderation), rate limits, and retry configuration. |
| Step 5: Output Blueprint YAML | Produce the complete blueprint YAML matching the schema from the template resource. |
| Step 6: Generate Agent Intelligence Graph | Build a multi-path DAG with classified tool nodes (Discovery, Enrichment, Action), guard nodes, policy nodes, external service nodes, and execution flow edges. |
| Step 7: Discover Sample Data | Search the codebase for seed files, fixtures, and test data to populate the sample_data field with real parameter values. Improves test case realism and coverage. |
The prompt also includes a confidence scoring rubric that rates the completeness of the generated blueprint as High, Medium, or Low.
When it is used:
The MCP client reads this resource when the user wants to register or update their agent. The client follows the prompt’s instructions to analyze the codebase and generate a blueprint, which is then validated with invarium_prepare_blueprint.
invarium://templates/trace-library
| Field | Value |
|---|---|
| URI | invarium://templates/trace-library |
| MIME type | text/x-python |
| Purpose | Single-file behavioral tracer for capturing tool calls during test execution |
The trace library is a Python file (invarium_trace.py) that the MCP client saves to .invarium/invarium_trace.py in the user’s project directory. It captures tool calls, LLM interactions, and behavioral data during test execution and streams results to the Invarium dashboard.
Capabilities:
| Feature | Description |
|---|---|
| LLM interaction capture | Captures behavioral data from your agent’s LLM interactions. |
| PII redaction | Includes automatic PII redaction before data leaves your machine. |
| Zero dependencies | No additional pip packages required beyond what the agent already uses. |
| Two usage modes | Import mode (use in your Python code) and CLI wrapper mode (run from the command line). |
| Live streaming | Results stream to the dashboard individually as each test case completes. |
| Behavioral fingerprint | Tracks tool call patterns for determinism analysis. |
Usage modes:
- Import mode — wrap the agent invocation in a tracing context within your Python code.
- Batch mode — run a list of test cases with automatic result streaming to the dashboard.
When it is used:
Prefer using invarium_setup_tracing instead of reading this resource directly — it downloads the tracer more efficiently without passing the full file through the conversation.
Do not modify invarium_trace.py after saving it. The file is managed by Invarium and may be updated in future versions. Modifications can break tracing or result in incomplete data.
invarium://templates/trace-prompt
| Field | Value |
|---|---|
| URI | invarium://templates/trace-prompt |
| MIME type | text/markdown |
| Purpose | Step-by-step guide for running behavioral test cases with tracing |
The trace prompt is a markdown guide that instructs the MCP client on how to set up and execute test cases against an agent with full behavioral tracing enabled.
Contents:
The prompt covers three steps:
| Step | Description |
|---|---|
| Step 1: Set Up the Tracer | Call invarium_setup_tracing to install the trace library as .invarium/invarium_trace.py. Alternatively, read the invarium://templates/trace-library resource and save it manually. |
| Step 2: Write the Test Script | Create test_run.py using the batch runner pattern. The script must invoke the agent the same way its API endpoint does. Includes framework-specific examples for LangChain and Google Gemini agents. |
| Step 3: Create Test Run and Execute | Call invarium_sync_results with create_empty=True to create a test run, share the dashboard link, update the script with the test_run_id, and run the script in the background. |
Framework-specific guidance:
The prompt includes tailored setup instructions for:
- LangChain agents — framework-specific configuration for full tracing
- Google Gemini agents — configuration for tool call visibility
- General agents — standard batch runner setup
When it is used:
The MCP client reads this resource when the user is ready to execute test cases (Phase 3). The client follows the prompt’s instructions to create the test script and run it against the agent.
Accessing Resources
Resources are typically read automatically by the MCP client when following the server’s workflow instructions. You do not need to call a tool to access them.
If your MCP client supports listing resources, you will see all four resources listed with their URIs, MIME types, and descriptions.
In the Workflow
| Workflow Phase | Resources Used |
|---|---|
| Phase 1: Agent Registration | invarium://templates/agent-blueprint, invarium://templates/blueprint-prompt |
| Phase 3: Test Execution | invarium://templates/trace-library, invarium://templates/trace-prompt |