# JSON Schema Function Call Validator MCP for AI Agents MCP

> JSON Schema Function Call Validator MCP verifies that LLM-generated JSON function calls strictly follow your defined schemas. It catches missing required parameters, type mismatches, and hallucinated fields before they break your downstream processes or API integrations.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_21yoFjCa6YURZm8sCCyeJadvPgEYlKfXVV7HUnII/mcp
- **Tags:** json-schema, llm-validation, function-calling, agentic-workflows, error-detection

## Description

Building agents is easy until they start hallucinating extra parameters or sending strings where you need integers. You spend half your time writing try-catch blocks just to handle malformed JSON from your LLM. This MCP acts as a gatekeeper for those outputs. It looks at the raw text your agent produces and compares it against your schema. If something is enough to break a pipeline, you get an error log instead of a crash. You can connect this through Vinkius to instantly add a layer of structural integrity to any workflow. No more guessing if your agent followed instructions; you'll know exactly where the breakdown happened.

## Tools

### validate_function_call
Checks a JSON payload against your schema to find errors. It identifies missing, extra, or incorrectly typed parameters immediately.

## Prompt Examples

**Prompt:** 
```
Is this function call valid for my schema?
```

**Response:** 
```
| Field | Status | Error |
| :--- | :--- | :--- |
| `name` | Valid | None |
| `arguments.location` | **Invalid** | Expected string, got integer |
| `arguments.extra_field` | **Invalid** | Hallucinated parameter |
```

**Prompt:** 
```
Why did my last tool call fail?
```

**Response:** 
```
The validation failed due to two specific issues:

* **Missing Parameter**: The `required` field `api_key` was not found in the payload.
* **Type Mismatch**: The `timeout` parameter was provided as a string `'30'` instead of an integer `30`.
```

**Prompt:** 
```
Check if these arguments match the required types.
```

**Response:** 
```
**Validation Summary:**
* **Validity Percentage:** 75%
* **Error Count:** 1
* **Details:** The parameter `user_id` must be an integer, but received a string value.
```

## Capabilities

### Catch type mismatches
Identifies when an agent sends a string instead of an integer or a boolean.

### Detect hallucinated parameters
Flags any extra fields in the JSON payload that are not defined in your schema.

### Identify missing required fields
Locates exactly which mandatory parameters were left out of the function call.

### Generate detailed error logs
Provides a clear breakdown of every validation failure for easier debugging.

### Monitor payload validity
Calculates a percentage score for how well your agent is adhering to the schema.

## Use Cases

### Broken API calls in production
An agent tries to call a weather API but sends 'London' as an integer. The validator catches the error before the API request is even sent.

### Hallucinated parameters in complex schemas
Your agent adds a 'format' field that does not exist in your schema. This MCP flags it as a hallucination immediately.

### Missing required fields in multi-step workflows
A developer needs all user IDs present in a batch update. The validator identifies exactly which ID is missing from the payload.

## Benefits

- Eliminate runtime crashes by catching malformed JSON before it hits your API.
- Identify hallucinated parameters using validate_function_call to keep schemas clean.
- Get specific error logs that pinpoint exactly which field failed validation.
- Monitor the reliability of your agentic workflows with real-time validity percentages.
- Ensure strict type adherence so strings never masquerade as integers in your payloads.

## How It Works

The bottom line is you stop broken function calls from crashing your downstream services.

1. Pass the raw LLM text output and your target JSON Schema to the MCP.
2. The validator parses the payload and compares every key and value against your rules.
3. You receive a detailed report containing error counts and specific failure logs.

## Frequently Asked Questions

**How can I prevent broken JSON in Claude?**
Use this MCP to check every output against a schema. It catches errors before they break your downstream logic.

**Does JSON Schema Function Call Validator detect extra fields?**
Yes, it specifically flags any parameters that appear in the payload but are not defined in your provided schema.

**Can I use this for debugging Cursor agent errors?**
Absolutely. You can pass the outputs from your Cursor agent through this MCP to see exactly why a tool call is failing.

**Will this MCP help with type mismatches in my agents?**
Yes, it identifies when an agent sends a string where an integer or boolean is required by your schema.

**How do I know if my agent is getting more reliable?**
You can monitor the parameter validity percentage returned by the MCP to track improvements in your agent's accuracy over time.

**What does the validator check for?**
It checks for missing required parameters, type mismatches (like a string where an integer is expected), and hallucinated parameters that are not defined in your JSON Schema.

**Can I use this to prevent hallucinations?**
Yes. By using `validate_function_call`, you can detect when an LLM attempts to use parameters that do not exist in your schema, allowing you to catch hallucinations before they reach your downstream logic.

**What format should the input be in?**
The `payloadJson` and `schemaJson` must both be provided as valid JSON strings.