How to build MCP servers and tools that accept sinc-prompt structured inputs. Schema validation, tool descriptions, and Python implementation patterns.
The Model Context Protocol (MCP) standardizes how AI applications connect to tools and data sources. sinc-prompt standardizes the prompt structure those tools receive. Together, they eliminate two sources of aliasing: MCP removes tool-discovery aliasing; sinc-prompt removes prompt-specification aliasing.
Every sinc-prompt carries exactly 6 frequency bands. An MCP tool that validates these bands before execution guarantees Nyquist-complete input — no hallucination from undersampled instructions.
When defining MCP tools, map the tool's input schema to sinc bands. This tells the AI client exactly what information each band requires.
{
"name": "analyze_codebase",
"description": "Analyze a codebase using sinc-prompt structured input.",
"inputSchema": {
"type": "object",
"properties": {
"prompt": {
"$ref": "https://tokencalc.pro/schema/sinc-prompt-v1.json",
"description": "sinc-prompt with 6 bands: PERSONA (analyst role), CONTEXT (repo info), DATA (files/metrics), CONSTRAINTS (rules), FORMAT (output structure), TASK (objective)"
}
},
"required": ["prompt"]
}
}
inputSchema, Claude and other MCP clients will automatically structure their requests with all 6 bands.
A complete Python MCP server using the mcp SDK that validates sinc-prompt inputs before processing.
pip install mcp sinc-llm
import json
from mcp.server import Server
from mcp.types import Tool, TextContent
from sinc_llm import scatter, compute_snr
app = Server("sinc-mcp-server")
def validate_sinc_prompt(data: dict) -> tuple[bool, str]:
"""Validate a sinc-prompt against the specification."""
# Check top-level fields
if "formula" not in data or "fragments" not in data:
return False, "Missing required fields: formula, fragments"
fragments = data.get("fragments", [])
if not isinstance(fragments, list):
return False, "fragments must be an array"
# Check all 6 bands present
band_indices = {f.get("n") for f in fragments}
required = {0, 1, 2, 3, 4, 5}
missing = required, band_indices
if missing:
band_names = {0: "PERSONA", 1: "CONTEXT", 2: "DATA",
3: "CONSTRAINTS", 4: "FORMAT", 5: "TASK"}
names = [band_names[i] for i in sorted(missing)]
return False, f"Missing bands: {', '.join(names)}"
# Check CONSTRAINTS is the longest (42.7% of quality)
by_n = {f["n"]: f for f in fragments}
constraints_len = len(by_n.get(3, {}).get("x", ""))
for n, frag in by_n.items():
if n != 3 and len(frag.get("x", "")) > constraints_len:
return False, (
f"Band {frag.get('t')} ({len(frag['x'])} chars) "
f"is longer than CONSTRAINTS ({constraints_len} chars). "
f"CONSTRAINTS must be the longest fragment."
)
return True, "Valid sinc-prompt"
@app.list_tools()
async def list_tools():
return [
Tool(
name="process_sinc_prompt",
description=(
"Process a sinc-prompt structured input. "
"Validates Nyquist completeness (6/6 bands), "
"computes SNR, then executes the task."
),
inputSchema={
"type": "object",
"properties": {
"prompt": {
"type": "object",
"description": "A sinc-prompt JSON object",
"properties": {
"formula": {"type": "string"},
"T": {"type": "string"},
"fragments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"n": {"type": "integer"},
"t": {"type": "string"},
"x": {"type": "string"}
},
"required": ["n", "t", "x"]
},
"minItems": 6
}
},
"required": ["formula", "fragments"]
}
},
"required": ["prompt"]
}
)
]
@app.call_tool()
async def call_tool(name: str, arguments: dict):
if name != "process_sinc_prompt":
return [TextContent(type="text", text=f"Unknown tool: {name}")]
prompt_data = arguments.get("prompt", {})
# Step 1: Validate
valid, message = validate_sinc_prompt(prompt_data)
if not valid:
return [TextContent(
type="text",
text=json.dumps({"error": message, "nyquist": "FAIL"})
)]
# Step 2: Compute SNR
fragments = prompt_data["fragments"]
snr = compute_snr(fragments)
# Step 3: Extract task
by_n = {f["n"]: f for f in fragments}
task = by_n[5]["x"]
persona = by_n[0]["x"]
constraints = by_n[3]["x"]
# Step 4: Execute (your logic here)
result = {
"nyquist": "6/6 PASS",
"snr": round(snr, 4),
"grade": (
"EXCELLENT" if snr >= 0.80 else
"GOOD" if snr >= 0.70 else
"ADEQUATE" if snr >= 0.65 else
"ALIASED"
),
"task_received": task[:200],
"output": "... your tool's output here ..."
}
return [TextContent(type="text", text=json.dumps(result, indent=2))]
if __name__ == "__main__":
import asyncio
from mcp.server.stdio import stdio_server
async def main():
async with stdio_server() as (read, write):
await app.run(read, write, app.create_initialization_options())
asyncio.run(main())
If your MCP tool receives raw (unstructured) prompts, use the sinc-llm library to auto-scatter them before processing.
from sinc_llm import scatter
# Raw prompt from MCP client
raw = "You are a code reviewer. Check this Python file for bugs. Be thorough."
# Auto-scatter into 6 bands
sinc_prompt = scatter(raw)
# Returns: {"formula": "...", "T": "specification-axis", "fragments": [...]}
# Now validate and process
valid, msg = validate_sinc_prompt(sinc_prompt)
print(f"Nyquist: {'PASS' if valid else 'FAIL'}, {msg}")
To use a sinc-prompt MCP server from Claude Code, add it to your .claude/mcp.json:
{
"mcpServers": {
"sinc-tools": {
"command": "python",
"args": ["-m", "sinc_llm.mcp_server"],
"env": {}
}
}
}
The sinc-llm package ships with a built-in MCP server at sinc_llm.mcp_server that exposes:
| Tool | Description |
|---|---|
sinc_scatter | Auto-scatter a raw prompt into 6 sinc bands |
sinc_validate | Validate a sinc-prompt JSON and compute SNR |
sinc_compute_snr | Compute SNR score with zone function breakdown |
Use the published JSON Schema for programmatic validation in your MCP server:
import json
import jsonschema
import urllib.request
# Fetch the schema
SCHEMA_URL = "https://tokencalc.pro/schema/sinc-prompt-v1.json"
schema = json.loads(urllib.request.urlopen(SCHEMA_URL).read())
# Validate a prompt
def validate_prompt(prompt_data: dict) -> bool:
try:
jsonschema.validate(prompt_data, schema)
return True
except jsonschema.ValidationError as e:
print(f"Validation failed: {e.message}")
return False
MCP tools should return structured error responses when sinc validation fails:
# In your MCP tool handler:
valid, message = validate_sinc_prompt(prompt_data)
if not valid:
return [TextContent(type="text", text=json.dumps({
"error": "SINC_VALIDATION_FAILED",
"message": message,
"nyquist_completeness": f"{count_bands(prompt_data)}/6",
"hint": "Ensure all 6 bands are present. "
"See https://tokencalc.pro/spec for the specification.",
"schema": "https://tokencalc.pro/schema/sinc-prompt-v1.json"
}, indent=2))]