Why a model wants this
An LLM asked to pull a value out of a large XML document otherwise has to read the whole thing into its context and pattern-match by eye. An XPath tool turns that into a question with an exact answer, and the document never has to fit in the context window.
Install
Configure
Tools
| Tool | What it does |
|---|---|
xml_query |
Evaluate an XPath 1.0 expression and return the matches |
xml_validate |
Validate against an XSD; returns every violation with its path |
xml_check |
Report whether a document is well-formed, with line and column |
xml_inspect |
Summarise structure — element counts, depth, names present |
xml_inspect exists because a model querying an unfamiliar document
needs to know its shape before it can write a sensible XPath.
Protocol
JSON-RPC 2.0 over stdio, protocol version 2024-11-05.
$ echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | oxml-mcp
{"jsonrpc":"2.0","id":1,"result":{"tools":[...]}}
Design
JSON is read and written by a small module in this crate rather than a serialisation dependency. The messages are few and their shapes are fixed, and for a server meant to be audited that is a worthwhile trade.
Notifications — requests without an id — get no reply, because
answering one is a protocol error rather than merely noise.
The oxml suite
Every member ships the same version number, so there is never a
compatibility table to consult. Versions advance in 0.0.1 steps along
the 0.0.x line; 0.1.0 follows 0.0.999.
| Crate | What it is |
|---|---|
oxml |
Core — parser, tree, XPath 1.0 |
oxml-cli |
Command-line querying and validation |
oxml-lsp |
Diagnostics for editors |
oxml-mcp |
Model Context Protocol server |
oxml-wasm |
WebAssembly bindings |
xmlschema |
XSD validation |
Contributing
See CONTRIBUTING.md. By participating you agree to the Code of Conduct.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.