This prompt is for MCP client developers and AI platform engineers who need to extract structured, machine-readable JSON Schema definitions from raw tool descriptions returned by MCP servers. The core job is normalization: taking sparse, inconsistent, or ambiguous metadata—where parameter types might be missing, descriptions vague, or constraints implied—and producing a clean, validated schema that an agent can reliably use for function calling. You should use this prompt when you are building the integration layer between an MCP server and an agent's tool registry, and the server's native descriptions are insufficient for strict, schema-driven tool selection.
Prompt
Tool Schema Introspection Prompt for MCP Clients

When to Use This Prompt
Define the job, reader, and constraints for the Tool Schema Introspection Prompt.
The ideal user is actively wiring a dynamic tool discovery pipeline. They have already received a raw tool listing from an MCP server's tools/list or equivalent endpoint, and they have that payload ready as the [RAW_TOOL_DESCRIPTIONS] input. Required context includes the server's stated API version, any known type system conventions (e.g., whether the server uses OpenAPI-style types or custom type strings), and the target output schema standard you are normalizing to (typically JSON Schema Draft 2020-12). Do not use this prompt for generating tool descriptions from scratch, for validating a hand-written manifest against a spec, or for runtime tool selection logic—those are separate playbooks. This prompt is specifically for the introspection and normalization step.
There are clear boundaries where this prompt is the wrong tool. If the MCP server already returns fully compliant JSON Schema for every tool and parameter, you do not need normalization; you need a validation pass. If you are trying to infer what a tool does from its name alone, you risk capability hallucination—use the Capability Hallucination Prevention System Prompt instead. If you are comparing two tool registries for drift, use the Runtime Tool Schema Change Detection Prompt. This prompt assumes you have raw, server-authored descriptions and need to convert them into a strict, typed contract. It does not perform semantic enrichment beyond what is present in the input; it clarifies, structures, and flags gaps, but it does not invent missing capabilities.
Before using this prompt, ensure you have a clear [OUTPUT_SCHEMA] defined—the exact JSON Schema structure you expect each normalized tool to conform to. This becomes your contract. Also prepare a set of [CONSTRAINTS] that encode your platform's rules: required fields, banned type fallbacks (e.g., never default to string when a type is missing), and enumeration rules for parameter categories. The prompt works best when you provide a few [EXAMPLES] of correctly normalized schemas alongside their raw inputs, establishing the transformation pattern. After generation, always validate the output against your [OUTPUT_SCHEMA] programmatically; the prompt includes a validation instruction, but you must implement the actual schema validator in your harness. For high-stakes tool registrations—where a malformed schema could cause an agent to call a destructive API with wrong arguments—route the normalized output through a human review step before registration.
Use Case Fit
Where the Tool Schema Introspection Prompt delivers reliable structured schemas—and where it introduces risk that requires a different approach.
Good Fit: Normalizing Sparse Tool Descriptions
Use when: MCP servers return tool descriptions with missing types, ambiguous parameters, or inconsistent formatting. Guardrail: The prompt should output a normalized JSON Schema with explicit type fields and confidence annotations for inferred properties. Always validate the output schema against a known-good baseline before registering tools in production.
Good Fit: Bootstrapping Agent Tool Registries
Use when: Initializing a new agent deployment from multiple MCP servers and API specs. Guardrail: Run the introspection prompt against each server endpoint, then pass the collected schemas through a deduplication and conflict detection step before final registry commit. Never auto-register without human review of the merged manifest.
Bad Fit: Runtime Schema Discovery on Every Request
Avoid when: You're tempted to call introspection on every agent turn to get fresh schemas. Risk: Adds latency, burns tokens, and introduces non-deterministic schema drift mid-session. Guardrail: Introspect at session start or on registry refresh triggers only. Cache the normalized schemas and use a staleness detector to trigger re-introspection.
Bad Fit: Poorly Documented Tools with No Examples
Avoid when: The tool has no parameter examples, no usage documentation, and ambiguous naming. Risk: The model will hallucinate plausible but wrong parameter types and constraints. Guardrail: Require at least one usage example or OpenAPI fragment per tool before trusting introspection output. Flag tools with confidence below threshold for manual documentation.
Required Inputs: Raw Tool Descriptions and Context
Use when: You have raw tool descriptions from MCP tools/list responses, OpenAPI specs, or documentation fragments. Guardrail: Always include the full raw description, any available parameter examples, and the expected output schema format. Missing context produces confident-looking but incorrect schemas. Add a confidence field to every output property.
Operational Risk: Schema Drift in Production
Risk: A tool provider updates their API, changing parameter types or adding required fields. The cached schema is now stale, and agents call the tool with wrong arguments. Guardrail: Pair this prompt with a runtime schema change detector that compares live responses against registered schemas. Trigger re-introspection and human review on detected drift before agents fail silently.
Copy-Ready Prompt Template
A reusable prompt template for extracting normalized JSON Schema representations from raw MCP server tool descriptions.
This prompt template is designed to be sent to an LLM that has received a raw tool description payload from an MCP server. The model's job is to introspect that payload, identify gaps in metadata, missing types, and ambiguous parameter definitions, and produce a clean, standards-compliant JSON Schema object for each tool. Use this template as the core instruction block in your MCP client's tool registration pipeline.
textYou are a tool schema normalization engine. Your input is a raw tool description from an MCP server. Your output must be a valid, strictly typed JSON Schema (Draft 2020-12) representation for each tool. Follow these rules: 1. For every input parameter, infer the most specific JSON Schema type possible (e.g., 'string', 'integer', 'boolean', 'object', 'array'). If a type is missing or ambiguous, use your best inference and set a 'x-inferred' property to true in the schema. 2. Generate a human-readable 'description' for every parameter and for the tool itself. If the source description is missing, write a concise description based on the parameter name and context. 3. Identify all required parameters. If the source does not specify required fields, mark parameters that appear essential for the tool's operation as required and note this inference in the 'x-inferred-required' property. 4. For enum parameters, extract all possible values. If values are not provided, set the 'enum' field to an empty array and add a note to the description. 5. Normalize all parameter names to camelCase. 6. Output a single JSON object with a 'tools' array. Each element in the array must have 'name', 'description', and 'inputSchema' keys. The 'inputSchema' must be a valid JSON Schema object. 7. If the input contains multiple tools, process all of them. 8. Do not hallucinate parameters or capabilities not present in the source text. If you are unsure about a property, omit it rather than guessing. [RAW_TOOL_DESCRIPTION]
To adapt this template, replace the [RAW_TOOL_DESCRIPTION] placeholder with the actual text or JSON payload received from the MCP server's tools/list or equivalent endpoint. For production systems, you should wrap this prompt in a validation harness that parses the output, checks it against the JSON Schema meta-schema, and flags any x-inferred properties for human review. If the tool will be used in a high-stakes domain, route any schema with inferred required parameters or missing enum values to a human-in-the-loop review queue before registering the tool with an agent.
Prompt Variables
Placeholders required by the Tool Schema Introspection Prompt. Replace each with concrete values before sending the prompt to the model. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TOOL_DESCRIPTION] | Raw text or JSON blob describing a tool, endpoint, or function as returned by an MCP server or API spec | "list_users" returns a paginated list of user objects with optional status filter | Must be non-empty string. If JSON, parse check passes. If plain text, length > 10 chars. Reject null or whitespace-only inputs. |
[OUTPUT_SCHEMA_VERSION] | Target JSON Schema draft version for the normalized output | draft-07 | Must match one of: draft-04, draft-06, draft-07, draft-2020-12. Reject unknown versions. Default to draft-07 if omitted. |
[REQUIRED_FIELDS] | List of field names that must appear in the normalized schema regardless of whether the source description includes them | ["name", "description", "parameters", "returns"] | Must be a valid JSON array of strings. Each string must be a valid identifier (alphanumeric + underscore, no leading digit). Empty array is allowed. |
[TYPE_INFERENCE_RULES] | Custom rules for inferring parameter types when the source description omits them | "string_fields": ["name", "email"], "integer_fields": ["id", "age"] | Must be a valid JSON object. Keys must be type names (string, integer, number, boolean, array, object). Values must be arrays of field name strings. Null allowed if no custom rules. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score (0.0 to 1.0) for inferred fields to be included in output without a warning flag | 0.8 | Must be a float between 0.0 and 1.0 inclusive. Values below 0.5 produce excessive warnings. Values above 0.95 may omit valid inferred fields. Default 0.8. |
[STRICT_MODE] | Boolean flag controlling whether the prompt should fail on ambiguous parameters or produce a best-effort schema with caveats | Must be true or false. When true, ambiguous parameters produce an error object instead of a guess. When false, best-effort output includes confidence annotations. | |
[MAX_PARAMETERS] | Upper bound on the number of parameters to extract, used to detect malformed or oversized tool descriptions | 50 | Must be a positive integer. Values above 200 may indicate a parsing error in the source. Set to null to disable the limit check. |
[ALLOWED_TYPE_VALUES] | Whitelist of valid JSON Schema type strings for parameter and return value definitions | ["string", "integer", "number", "boolean", "array", "object", "null"] | Must be a JSON array of strings. Each string must be a valid JSON Schema type. Reject if array contains unknown type values. Default shown if omitted. |
Implementation Harness Notes
How to wire the Tool Schema Introspection Prompt into an MCP client application with validation, retries, and safe defaults.
This prompt is designed to be called programmatically by an MCP client after receiving a raw tool description from a server. The client should treat the prompt as a normalization layer that sits between the server's tools/list response and the agent's tool registry. Do not expose raw server output directly to the agent's context; always pass it through this introspection prompt first to produce a validated, normalized JSON Schema representation. The prompt expects two inputs: the raw tool description text and a target output schema that defines the required fields. Wire the prompt into a dedicated ToolSchemaNormalizer service that is invoked during tool registration, not during agent execution, to avoid adding latency to time-sensitive tool calls.
Validation and retry logic is mandatory. After receiving the model's JSON output, validate it against the expected JSON Schema using a server-side validator such as ajv. If validation fails, retry the prompt once with the validation errors appended to the [CONSTRAINTS] field. If the second attempt also fails, log the raw server response, the failed model output, and the validation errors as a structured incident, then fall back to a minimal safe schema that includes only the tool name and a generic object type with no parameters. This prevents a single malformed tool description from blocking agent startup. For high-risk production deployments, add a human review queue for tools that fail normalization twice, especially if they originate from untrusted third-party MCP servers.
Model choice matters. Use a model with strong JSON Schema generation capabilities and strict mode support, such as GPT-4o with response_format set to json_schema or Claude 3.5 Sonnet with structured output enabled. Avoid models that are prone to hallucinating fields when given sparse input. Set temperature=0 to maximize determinism. For the [OUTPUT_SCHEMA] placeholder, provide the exact JSON Schema you expect the model to populate, including required fields like name, description, inputSchema (with type, properties, and required), and outputSchema. The prompt template includes a [CONFIDENCE_THRESHOLD] parameter; set this to 0.7 by default and flag any tool where the model's self-reported confidence falls below this threshold for manual review. Log every normalization result with the tool name, server origin, confidence score, and whether fallback was triggered for auditability and debugging.
Expected Output Contract
Define the exact shape, types, and validation rules for the normalized tool schema output. Use this contract to build a parser that rejects malformed responses before they reach the agent registry.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
tool_name | string | Must match pattern ^[a-zA-Z_][a-zA-Z0-9_-]*$. Reject if empty or contains only whitespace. | |
description | string | Minimum 10 characters. Must not be identical to tool_name. Reject if null or missing. | |
parameters | array of objects | Must be a valid JSON array. Reject if not present or not parseable as an array. Minimum 0 items allowed. | |
parameters[].name | string | Must match pattern ^[a-zA-Z_][a-zA-Z0-9_]*$. Must be unique within the parameters array. Reject duplicates. | |
parameters[].type | string (enum) | Must be one of: string, number, integer, boolean, array, object. Reject unknown types. Default to string if missing but log a warning. | |
parameters[].description | string | Minimum 5 characters. Reject if missing or empty. Flag for human review if description is identical to parameter name. | |
parameters[].required | boolean | Must be true or false if present. Default to false if absent. Reject non-boolean values. | |
parameters[].enum | array of strings | If present, must be a non-empty array of unique strings. Reject if present but empty. Ignore if type is not string. | |
output_schema | object (JSON Schema) | If present, must be a valid JSON Schema object with a type property. Reject if present but fails JSON Schema meta-validation. Null allowed. | |
source_confidence | number | Must be a float between 0.0 and 1.0 inclusive. Represents confidence in the extracted schema. Flag for human review if below 0.7. | |
missing_fields | array of strings | List of expected fields not found in the source description. Must be an array, can be empty. Reject if null or not an array. | |
inferred_fields | array of strings | List of field names where type or description was inferred rather than explicitly stated. Must be an array, can be empty. Reject if null. |
Common Failure Modes
Tool schema introspection fails silently in production when metadata is sparse, types are ambiguous, or server responses drift. These cards cover the most common failure patterns and how to guard against them before they corrupt your agent's tool registry.
Hallucinated Parameter Types
What to watch: The model infers parameter types from names alone when the server returns no explicit type field. A parameter named count gets typed as integer even when the server expects a string representation. Guardrail: Require explicit type fields in the output schema. When the source omits types, mark the field as unknown with a confidence flag rather than guessing. Add a validation step that flags any inferred type for human review before registration.
Missing Required Parameter Flags
What to watch: Sparse server descriptions omit whether parameters are required or optional. The model defaults to marking everything as optional, causing downstream agents to call tools with missing arguments and cryptic server errors. Guardrail: Add a post-extraction rule that requires explicit required boolean fields. When the source is silent, default to required: true and flag for review. Test with a schema completeness check that rejects manifests with unresolved optionality.
Schema Drift After Server Update
What to watch: The server adds, removes, or renames parameters without versioning. The introspection prompt extracts the new schema, but downstream agents still reference the old parameter names, producing silent failures or wrong results. Guardrail: Pair this prompt with a runtime schema change detection prompt. Store a hash of the last known schema and compare on each refresh. When drift is detected, block automatic registration and route to a human-in-the-loop review queue.
Ambiguous Enum and Constraint Extraction
What to watch: Servers describe valid values in natural language without structured enum definitions. The model either omits constraints entirely or hallucinates plausible enum values that don't match the actual API contract. Guardrail: Add an explicit extraction instruction that maps constraint language to structured enum or pattern fields only when the source provides an exhaustive list. When constraints are described but not enumerated, output a constraint_description field instead of a guessed enum and flag for manual enrichment.
Nested Object Schema Collapse
What to watch: Complex nested parameter structures get flattened or summarized into vague object types without internal property definitions. Agents can't construct valid nested payloads and fail at invocation time. Guardrail: Require recursive schema extraction in the prompt instructions. Add a post-processing validator that checks for type: object fields without properties definitions and rejects them. Test with a nested schema fixture that must produce fully expanded property trees.
Confidence Overstatement on Sparse Inputs
What to watch: The model produces high-confidence schemas from nearly empty server descriptions, giving downstream systems false assurance that the extracted contract is complete and correct. Guardrail: Add a required confidence field to every extracted schema property, scored as confirmed, inferred, or uncertain. Require that any schema with more than a threshold of inferred fields triggers a human review gate before agent registration. Log confidence distributions for auditability.
Evaluation Rubric
Use this rubric to test the Tool Schema Introspection Prompt before deploying it into an MCP client pipeline. Each criterion targets a known failure mode in schema extraction from sparse or ambiguous tool descriptions.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Schema Completeness | Every input parameter from the raw description appears in the output JSON Schema with a type, description, and required flag. | Missing parameters; parameters present in raw input but absent from output schema. | Diff extracted parameter names against a manually verified ground-truth list for 10 test tools. |
Type Inference Accuracy | Inferred types for ambiguous parameters (e.g., 'id', 'count') match a pre-labeled validation set in at least 90% of cases. | String inferred where integer is correct; object inferred where array is correct; null type assigned. | Run prompt against 20 hand-labeled ambiguous parameters and measure exact-match accuracy. |
Required Field Detection | Parameters marked as required in the raw description (via 'required', 'mandatory', or positional convention) are correctly placed in the 'required' array. | Required parameter missing from required array; optional parameter incorrectly listed as required. | Parse output schema's 'required' array and compare to a manually annotated required/optional map for each test tool. |
Hallucinated Parameter Prevention | Output schema contains zero parameters not present in the raw tool description. | Extra parameters invented by the model; plausible but unsupported fields added to the schema. | Count parameters in output schema and verify each has a traceable origin in the input description. Fail if count exceeds input. |
Enum Value Extraction | All enum values explicitly listed in the raw description appear in the output schema's 'enum' array, with no added or missing values. | Truncated enum list; invented enum values; enum values extracted from examples rather than definitions. | String-match output enum arrays against source description enum lists for 5 tools with known enum parameters. |
Nested Object Handling | Nested parameter structures (object properties, array items) are correctly expanded into valid JSON Schema with complete sub-schemas. | Nested object flattened to string; array items type missing; deep nesting truncated. | Validate output against JSON Schema meta-schema. Check that nested 'properties' and 'items' keywords are present where input describes compound types. |
Confidence Annotation | Parameters with ambiguous or missing type information include a 'confidence' annotation field set to 'low' or 'inferred'. | All parameters marked with high confidence; confidence field absent when ambiguity is present in source. | Scan output for 'confidence' field on parameters where source description lacks explicit type keywords. Fail if absent on >10% of ambiguous params. |
Output Schema Validity | Generated output is valid JSON Schema (Draft 2020-12 or specified version) and passes a standard schema validator. | Schema validation errors; missing required JSON Schema keywords; invalid type values. | Run output through a JSON Schema validator library. Fail on any validation errors. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single MCP server response. Remove strict output schema enforcement and accept best-effort JSON. Focus on extracting tool names, descriptions, and parameter names without requiring full type resolution.
codeExtract all tools from this MCP server response. For each tool, list: - tool name - description (if present) - parameter names (if present) Return as JSON array. Skip type inference. [MCP_SERVER_RESPONSE]
Watch for
- Missing parameter types when server omits them
- Hallucinated tools not present in the response
- Nested tool definitions inside
toolsorcapabilitieskeys being missed

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us