Sezzlee XML

v0.5.2
io.github.sezzlee/xml Checked 10 hours ago Published 7 days ago

Query local XML documents with XPath, paged and sandboxed to one folder.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_documents

List readable XML documents under the server root. Returns filePath values that other tools accept verbatim. The listing never parses a file, so a listed path is a candidate, not a guarantee of well-formed XML. totalExact distinguishes a complete total; scanTruncated is separate from the result page limit.

ParameterTypeDescription
maxResultsintegerMaximum returned files, default 50. Does not increase the traversal budget.
patternstringGlob over the relative path, for example build/*.csproj.
subdirectorystringFolder under the root to list.

describe_document

Summarise one XML document: the document element, every namespace with a stable alias, a bounded structure count, repeated-element candidates and an address read_node accepts. Repetition candidates are observations, not a schema. Counts carry an exact flag; a sampled count says so.

ParameterTypeDescription
filePath *stringDocument path relative to the root, as returned by list_documents.
maxPathsintegerMaximum repetition candidates and mixed-content examples, default 20.

read_node

Read a bounded, ordered slice of one document as flat depth-first records. Every record carries nodeId, parentId and childIndex, so text, element, comment and processing-instruction order survives a page boundary. Values are returned as written: no trimming, no number or date conversion. An element held back by maxDepth is marked childrenOmitted and needs its own call with that address; the cursor never delivers it.

ParameterTypeDescription
filePath *stringDocument path relative to the root, as returned by list_documents.
addressarraySegment path from the document element inclusive. Not an XPath expression; describe_document returns one you can pass straight back.
cursorstringnextCursor from a previous read_node response. Cannot be combined with address.
maxDepthintegerLevels below the addressed node to descend, default unlimited within the depth ceiling. 0 returns that node alone.
maxNodesintegerMaximum records in one page, default 50. The response byte budget may stop the page earlier.

find_in_document

Find literal text in one document's text nodes and attribute values. Case-sensitive and literal: the query is never treated as a regular expression or a query language. totalMatches appears only when the scan finished; a stopped scan reports scannedCount and matchedSoFar instead.

ParameterTypeDescription
filePath *stringDocument path relative to the root, as returned by list_documents.
query *stringLiteral text to look for. Case-sensitive; not a pattern.
cursorstringnextCursor from a previous find_in_document response. Cannot be combined with scopeAddress.
matchModestringSubstring match (default) or whole-value equality.
maxResultsintegerMaximum matches in one page, default 50.
scopeAddressarrayRestrict the scan to this element's subtree.
searchInstringSearch text nodes (default), attribute values, or both. With both, a text hit and an attribute hit on the same element are reported separately.

select_xpath

Evaluate one XPath 1.0 expression against a document. The expression is passed to the engine exactly as written: no rewriting, no namespace guessing, no extension functions, and nothing from XPath 2.0 or later. resultType separates a node-set from a string, number or boolean, so an empty node-set, an empty string, false and 0 all survive as themselves; a number carries numberKind so NaN and infinity are never a silent null. Node-set members are addressed where an address exists; a prolog comment and a namespace node carry unaddressable instead. Evaluation may materialise the whole node-set, so…

ParameterTypeDescription
filePath *stringDocument path relative to the root, as returned by list_documents.
xpath *stringXPath 1.0 expression.
cursorstringnextCursor from a previous select_xpath response. The expression is evaluated again, so continuing costs what the first call cost.
maxResultsintegerMaximum node-set members in one page, default 50. The response byte budget may stop the page earlier. Ignored for a string, number or boolean result.
namespacesarrayPrefix bindings for the expression. A prefix used but not bound is an error; the expression is never rewritten to guess one.

project_records

Turn a repeated element into rows and named columns. Values are returned as written: no trimming, no number or date conversion. A cell says which of four things happened: present, empty when the value exists and is the empty string, missing when the address matches nothing, and multiple when several nodes match and no policy chose one. Rows carry occurrence rather than a repeated address; a row's canonical address is itemParentAddress plus itemName at that occurrence.

ParameterTypeDescription
columns *arrayColumns to read from each record. where, groupBy and metrics name a column by its label.
filePath *stringDocument path relative to the root, as returned by list_documents.
itemAddress *objectThe record set: singular ancestors plus one repeated child name. This is not an XPath expression and the wildcard applies to the repeated child only.
caseSensitivebooleanCase-sensitive comparison, default true. XML names and values are case-sensitive; false lowercases both sides and does not fold accents.
cursorstringnextCursor from a previous project_records response. Cannot be combined with different options.
matchstringCombine conditions with all (default) or any.
maxRowsintegerMaximum rows in one page, default 50. The response byte budget may stop the page earlier.
wherearrayRow filter over declared columns. Comparisons are textual: a multiple cell never matches one, and no value is converted to a number.

aggregate_document

Count and summarise a repeated element in one call, instead of paging the records. count needs no column and is always available. sum, avg, min and max require numericMode: binary64, which is an explicit acceptance that values become binary64 doubles: a value with more digits than that holds is refused rather than quietly changed, and values that cannot be represented exactly are counted in rounded. groupCount and matchedItems cover the whole scan even when maxGroups cuts the returned groups.

ParameterTypeDescription
columns *arrayColumns to read from each record. where, groupBy and metrics name a column by its label.
filePath *stringDocument path relative to the root, as returned by list_documents.
itemAddress *objectThe record set: singular ancestors plus one repeated child name. This is not an XPath expression and the wildcard applies to the repeated child only.
metrics *arrayValues to compute. Each metric becomes one output column after the groupBy columns.
caseSensitivebooleanCase-sensitive comparison, default true. XML names and values are case-sensitive; false lowercases both sides and does not fold accents.
descendingbooleanDescending order, default false.
groupByarrayLabels of declared columns to group by. Omit for one whole-set total.
matchstringCombine conditions with all (default) or any.
maxGroupsintegerMaximum groups returned, default 50. groupCount still reports every group the scan found.
numericModestringoff (default) offers only the counting metrics. binary64 enables sum, avg, min and max with double precision.
orderBystringOrder groups by group key (default) or by one metric.
orderByMetricintegerOne-based index into metrics, default 1.
wherearrayRow filter over declared columns. Comparisons are textual: a multiple cell never matches one, and no value is converted to a number.