---
title: "Automated MCP Testing: Using Composable Goose Recipes to Validate Tool Metadata"
description: "Automate MCP tool metadata validation using composable Goose recipes to catch regressions, optimize token usage, and ensure AI agents can reliably discover and use your tools."
authors:
- rarora
---

# Automated MCP Testing: Using Composable Goose Recipes to Validate Tool Metadata
When building Model Context Protocol (MCP) servers, most development focuses on tool functionality, ensuring tools execute and return expected results. But just as critical is the quality of tool metadata: descriptions, tooltips, and input schemas. These elements form the "interface language" between tools and AI agents like Goose.
Yet metadata often goes untested. This can break tool discovery and silently degrade agent behavior. In this post, we’ll show how to automate metadata validation using **composable Goose recipes**, turning manual QA into modular, repeatable workflows that:
- Validate tool discoverability and parameter accuracy
- Detect regressions early
- Safely reduce token usage
All while maintaining the quality that AI agents depend on.
## 1. The Challenges of Manual Metadata Testing
Manually validating MCP metadata—by running queries and inspecting agent behavior—breaks down quickly as your toolset grows. It’s inefficient, inconsistent, and prone to silent regressions.
#### Key Limitations:
- **Slow & Unscalable**: Requires spinning up the agent, entering queries, and reviewing outputs by hand.
- **Inconsistent Results**: Varies across environments and models, making issues hard to reproduce.
- **Silent Failures**: Broken tooltips lead to incorrect tool selection, missing or misinterpreted parameters, and tool conflicts.
- **No Regression Safety Net**: Changes in one tool’s metadata can affect others with no system in place to detect it.
- **Poor Coverage**: Manual QA can’t account for the diversity of real-world user queries.
To keep pace with growing MCP complexity, **automated metadata validation becomes a practical necessity**.
## 2. System Overview: Modular and Composable Goose Recipes
The foundation of this framework is [Goose’s recipe engine](https://goose-docs.ai/docs/guides/recipes/). Recipes define reusable, declarative workflows for AI-assisted tasks. Each one encapsulates a step—like generating predictions or comparing results—and can be composed into larger pipelines.
We start with a core recipe that maps natural language queries to tool calls. It reads queries, analyzes the toolset, and produces structured JSON mappings. This recipe becomes the building block for workflows like:
- Evaluating predictions against a gold set
- Integrating regression checks into CI
- Running token optimization loops
By chaining and wrapping recipes, we avoid duplication and unlock scalable, repeatable QA for MCP tool discoverability.
## 3. The Core Engine: Goose Recipe for Tool Prediction
At the heart of the system is a Goose recipe that systematically transforms natural language queries into structured tool predictions. This recipe follows a clear three-step process:
> **read queries → analyze tools → generate predictions**
#### 🔄 How It Works: Step-by-Step
**Step 1: Read Queries**
The recipe starts by reading a plain text file containing natural language queries, one per line:
```
List contributors to the block/mcp repository
List the top 10 contributors to aaif-goose/goose
Show me the closed branches in block/mcp
Show me all branches in the aaif-goose/goose repository
```
**Step 2: Ask Goose to Make Predictions**
Using the developer extension, Goose analyzes the MCP server source code and documentation to understand available tools, their parameters, and usage patterns. It then maps each query to the most appropriate tool call.
**Step 3: Write Predictions to JSON**
The output is a structured JSON file with each query mapped to its expected tool and parameters.
#### 🔧 Complete Recipe Specification
Click to expand full recipe YAML
```yaml
version: 1.0.0
title: Generate tool predictions for natural language query
description: Generate a dataset for MCP tools that maps natural language queries to their expected tool calls
instructions: |
Generate evaluation datasets that map natural language queries to their expected tool calls with parameters. Analyze tool documentation and source code to understand available functions, their parameters, and usage patterns. Create comprehensive JSON test cases that include the original query, expected tool name, and all required/implied parameters with realistic values. The output should be a complete JSON file with test_cases array, where each case maps a natural language request to its corresponding structured tool call. Use developer tools to examine source files, read documentation, and write the final JSON dataset to disk.
For each query, provide
- The natural language query
- The expected tool name
- All required parameters with appropriate values
- Any optional parameters that are clearly implied by the query
Tools documentation: {{ server_input }}, {{ tool_documentation }}
Please generate a JSON file mapping queries to their expected tool calls with parameters.
{
"test_cases": [
{
"query": "Show me open pull requests in the aaif-goose/goose repository",
"expected": {
"tool": "tool_name",
"parameters": {
"repo_owner": "block",
"repo_name": "goose",
"p1": "test",
"p2": "test"
}
}
},
{
"query": "Create a new issue titled 'Update documentation' in the mcp repo",
"expected": {
"tool": "tool_name",
"parameters": {
"repo_owner": "block",
"repo_name": "mcp",
"p1": "test",
"p2": "test"
}
}
}
]
}
Query Input - {{ quey_input }}
Output File - {{ output_file }}
prompt: Generate evaluation datasets that map natural language queries to their expected tool calls with parameters. Analyze tool documentation and source code to understand available functions, their parameters, and usage patterns. Create comprehensive JSON test cases that include the original query, expected tool name, and all required/implied parameters with realistic values. The output should be a complete JSON file with test_cases array, where each case maps a natural language request to its corresponding structured tool call. Use developer tools to examine source files, read documentation, and write the final JSON dataset to disk. Read instructions for more details.
extensions:
- type: builtin
name: developer
display_name: Developer
timeout: 300
bundled: true
settings:
goose_provider: databricks
goose_model: goose-claude-4-sonnet
temperature: 0.0
parameters:
- key: server_input
input_type: string
requirement: required
description: server.py file path
default: src/mcp_github/server.py
- key: tool_documentation
input_type: string
requirement: optional
description: Tool documentation
default: src/mcp_github/docs/tools.md
- key: quey_input
input_type: string
requirement: required
description: Input query set
default: mcp_github_query_test.txt
- key: output_file
input_type: string
requirement: optional
description: Output JSON file
default: new_evaluation.json
activities:
- Map queries to tool calls
- Extract tool parameters
- Generate test datasets
- Analyze API documentation
- Create evaluation benchmarks
author:
contact: user
```
Click to expand full evaluation recipe YAML
```yaml
version: 1.0.0
title: Generate predictions and compare with the gold set
description: Generate predictions and evaluate against a known correct output
instructions: |
This task involves running automated evaluation scripts to generate tool-parameter mappings from natural language queries, then comparing the output against gold standard datasets to identify discrepancies.
Command to generate output: goose run --recipe generate_predictions_recipe.yaml --params output_file={{ output_file }}
Script to compare 2 files: python compare_results.py {{ output_file }} {{ gold_file }}
Go over the output of the comparison script and highlight what cases differ in terms of tool name or parameters. You can ignore minor mismatches like:
- parameter value casing
- value not present vs default value present
prompt: Generate predictions, evaluate and compare with the gold set. Read instructions for more details.
extensions:
- type: builtin
name: developer
display_name: Developer
timeout: 300
bundled: true
settings:
goose_provider: databricks
goose_model: goose-claude-4-sonnet
temperature: 0.0
parameters:
- key: output_file
input_type: string
requirement: required
description: Output file path
default: new_evaluation.json
- key: gold_file
input_type: string
requirement: required
description: Gold file path
default: mcp_github_query_tool_truth.json
activities:
- Generate evaluation datasets
- Compare JSON outputs
- Analyze parameter mismatches
- Run recipe commands
- Identify tool mapping errors
author:
contact: user
```
Click to expand full token reduction recipe YAML
```yaml
version: 1.0.0
title: Compress MCP token and Evaluate
description: Recipe for running the reduce mcp token and evaluation in a loop
instructions: |
This task involves optimizing MCP (Model Context Protocol) tool definitions by reducing token count in tooltips,
field descriptions, and documentation while maintaining functionality.
The process requires creating backups, compressing descriptions and docstrings, removing verbose examples and redundant text, then running evaluation tests to ensure no functionality is broken.
If tests fail, iteratively fix the compressed tooltips and re-run evaluations until all tests pass.
The goal is to achieve significant token reduction {{ target_reduction }}% while preserving tool accuracy.
Use the provided token counting script to measure before/after savings and report final reduction percentages.
Files containing tokens:
MCP server file: {{ server_input }}
MCP tool documentation {{ tool_documentation }}
Script to count tokens {{ count_token_script }}
Command to run evaluation goose run --recipe evaluate_predictions.yaml
prompt: Reduce token count for tool descriptions and tooltips and make sure evaluation succeeds. Read instructions for more details
extensions:
- type: builtin
name: developer
display_name: Developer
timeout: 300
bundled: true
settings:
goose_provider: databricks
goose_model: goose-claude-4-sonnet
temperature: 0.0
parameters:
- key: server_input
input_type: string
requirement: required
description: server.py file path
default: src/mcp_github/server.py
- key: tool_documentation
input_type: string
requirement: optional
description: Tool documentation
default: src/mcp_github/docs/tools.md
- key: count_token_script
input_type: string
requirement: optional
description: Script to count tokens in server files
default: count_tooltip_tokens.py
- key: target_reduction
input_type: number
requirement: optional
description: Target reduction in token count we want to achieve
default: 30
activities:
- Compress tool tooltips
- Remove verbose examples
- Run evaluation tests
- Fix failing test cases
- Calculate token savings
author:
contact: rarora
```