quint_parse
Parse Quint specification code to generate JSON-formatted intermediate representation for AST inspection and error detection.
Instructions
Parse a Quint spec and return the intermediate representation (IR) as JSON. Useful for inspecting the AST or checking for parse errors.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "quint_parse"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | No | Quint specification source code (.qnt content) | |
| file_path | No | Path to a .qnt file on disk |
Implementation Reference
- index.js:324-359 (handler)The implementation of the 'quint_parse' tool, which takes a source string and file path, runs the quint parse command, and returns the resulting IR JSON.
server.tool( "quint_parse", "Parse a Quint spec and return the intermediate representation (IR) as JSON. Useful for inspecting the AST or checking for parse errors.", sourceSchema, async ({ source, file_path }) => { try { const outFile = join( tmpdir(), `quint_ir_${randomBytes(8).toString("hex")}.json`, ); const result = await runWithSource(source, file_path, (f) => [ "parse", `--out=${outFile}`, f, ]); if (result.ok) { try { const ir = await readFile(outFile, "utf-8"); await unlink(outFile).catch(() => {}); return { content: [{ type: "text", text: ir }] }; } catch { return formatResult(result); } } await unlink(outFile).catch(() => {}); return formatResult(result); } catch (err) { return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true, }; } }, );