# validate_spec

Lint a .3tg.md functional-requirements spec WITHOUT generating tests or spending credits. Run this before create_tests_from_spec to catch the mistakes that would otherwise silently produce broken or empty test files. WHY THIS EXISTS: 3TG's spec parser is deliberately lenient — it never errors on a malformed .3tg.md, it just silently ignores tables it can't parse and emits whatever column names it sees. So a spec can look fine yet compile to nothing useful. This tool runs the same parse 3TG would, then cross-checks the result against the source's real exports (via 3TG's own analysis) and reports problems. WHAT IT CATCHES: - ERROR: the spec parsed to an empty config (no valid table — usually a wrong return-column header; it must be the literal =>, or a row/header column-count mismatch). - ERROR: a table targets a function the source does not export (the generated test would import a non-existent symbol). - WARNING: a parameter column matches no parameter of any exported function (likely a typo such as input_a for a). - INFO: exported functions the spec doesn't cover yet. WHAT IT CANNOT CHECK: whether the => expected-return values are arithmetically correct — 3TG itself doesn't verify that. Treat a valid: true result as "structurally sound and ready to compile", not "the expected values are right". This tool is FREE — no clientId, no quota, no test cases consumed. Surface the summary and any diagnostics back to the user; if there are errors, help them fix the spec, then re-validate.

Agent View of the PolicyLayer registry record for `validate_spec`. HTML page: https://policylayer.com/tools/dev-3tg-mcp/validate-spec

## Facts

- Tool: `validate_spec`
- Server: 3TG Test Generation (`https://mcp.3tg.dev/mcp`) — https://policylayer.com/tools/dev-3tg-mcp.md
- Homepage: https://github.com/https://mcp.3tg.dev/mcp
- Risk category: Read (Low risk)
- Registry record: grade D, identity unverified
- Server auth posture: open
- Server rate-limited: no
- Parameters: 3 (3 required)
- Recommended policy verdict: Allowed

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `fileName` | string | yes | Path of the source file relative to the project root (e.g. "src/foo/bar.ts"). Must end in `.ts` or `.tsx` — the extension tells 3TG whether to parse a React com |
| `sourceCode` | string | yes | Full UTF-8 contents of the source file the spec describes. Needed so 3TG can compute the ground-truth list of exported functions and their parameter names to cr |
| `specContent` | string | yes | Full UTF-8 contents of the `.3tg.md` spec to validate — exactly as it lives under `.3tg/<sourceDir>/<basename>.3tg.md`. |

Parameters from the server's own tool schema.

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "validate_spec",
    "arguments": {
      "fileName": "<fileName>",
      "sourceCode": "<sourceCode>",
      "specContent": "<specContent>"
    }
  }
}
```

## Why validate_spec is rated Low

validate_spec is purely an inspection and validation tool. It reads and parses a specification file, performs analysis and checks, and returns results—no side effects, no data creation or modification, no code execution with external effects. This is a classic Read operation: data retrieval and validation without mutation.

From the tool's own definition: "Tool description states it performs validation/linting WITHOUT generating tests, creating files, or modifying state. Uses verbs like 'lint', 'cross-checks', and 'runs' (a parser in read-only mode)."

Risk signals: Accepts file system path (fileName)

## Use case

AI agents call validate_spec to retrieve information from 3TG Test Generation without modifying anything. It is typically the context-gathering step in research, monitoring, and reporting workflows, before the agent takes action elsewhere.

## Recommended policy (PolicyLayer)

Verdict: **Allowed**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches 3TG Test Generation:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "validate_spec": {}
  }
}
```

## Other tools on 3TG Test Generation (9)

- `get_client_info` — Read — https://policylayer.com/tools/dev-3tg-mcp/get-client-info.md
- `help` — Read — https://policylayer.com/tools/dev-3tg-mcp/help.md
- `validate_config` — Read — https://policylayer.com/tools/dev-3tg-mcp/validate-config.md
- `create_agent_instructions` — Write — https://policylayer.com/tools/dev-3tg-mcp/create-agent-instructions.md
- `create_mock_for_function` — Write — https://policylayer.com/tools/dev-3tg-mcp/create-mock-for-function.md
- `create_spec` — Write — https://policylayer.com/tools/dev-3tg-mcp/create-spec.md
- `create_spec_for_function` — Write — https://policylayer.com/tools/dev-3tg-mcp/create-spec-for-function.md
- `create_tests` — Write — https://policylayer.com/tools/dev-3tg-mcp/create-tests.md
- `create_tests_from_spec` — Write — https://policylayer.com/tools/dev-3tg-mcp/create-tests-from-spec.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=dev-3tg-mcp · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/dev-3tg-mcp
