Xpath10 evaluate
xpath10-evaluate · version 1.0.0 · Structured formats · free, no key needed
Evaluate an XPath 1.0 value expression and return its type with an exact string, number, or boolean token.
Use when you need to: evaluate an xpath 1.0 value expression · xpath 1.0 expression result type · xpath core functions without a document.
Decide before calling
Read the versioned contract and the supported scope below. Reuse xpath10-evaluate@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use xpath10-evaluate@1.0.0 for evaluate an xpath 1.0 value expression. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- evaluate an xpath 1.0 value expression
- xpath 1.0 expression result type
- xpath core functions without a document
- tagged xpath 1.0 string number or boolean
- compute an xpath 1.0 expression value
- xpath literals operators and core functions
- xpath 1.0 value subset result
- חישוב xpath evaluate
Not supported
- select XML nodes
- bind XPath variables
- evaluate XPath 2.0 or XQuery
Behavior
- Evaluates one XPath 1.0 value expression and returns type string, number, or boolean. result is always a string token: the string itself, the numeric token (-0 for negative zero), or true or false. xpath_string is the section 4.2 conversion. Negative zero's xpath_string is 0.
- The same expression subset, conversions, short-circuit, and rejections as the typed tools. This tool accepts every result type the subset can produce.
- Keyword operators match only token kind name. Symbolic operators and parentheses match only kind op. Quoted operator spellings are syntax errors.
- Key order is type, result, xpath_string. A string result of 86 code points produces 219 UTF-8 bytes of JSON, the output cap. 87 code points is limit_exceeded.
- Check order: input bytes, parse limits and unsupported syntax, the 96-character string cap, then output bytes. There is no result_type rejection.
- / is not division. Node-sets, variables, predicates, axes, namespaces, and XPath 2.0 are rejected by name rather than approximated.
Input
expression(string, required): min length 1; max length 512; XPath 1.0 value expression. maxLength counts Unicode code points. The UTF-8 cap is limits.max_input_bytes.
Output
type(one of "string", "number", "boolean", required)result(string, required): max length 96; String value, numeric token (negative zero is -0), or true or false. Empty is allowed for a string.xpath_string(string, required): max length 96; Section 4.2 conversion. Negative zero is 0. Booleans are true or false.
Limits
- max input bytes: 512
- max string codepoints: 96
- max depth: 8
- max nodes: 21
- max arguments: 4
- max output bytes: 219
Example
Request input:
{
"expression": "substring(\"12345\",2,3)"
}
Response:
{
"result": {
"type": "string",
"result": "234",
"xpath_string": "234"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "xpath10-evaluate",
"version": "1.0.0",
"input": {
"expression": "substring(\"12345\",2,3)"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/xpath10-evaluate/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"expression":"substring(\"12345\",2,3)"}'
The machine-readable contract is at /v1/tools/xpath10-evaluate/versions/1.0.0.
CLI
node cli.mjs run xpath10-evaluate 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Xpath10 boolean: Evaluate an XPath 1.0 boolean expression: comparisons, and, or, not, starts-with, contains, and boolean conversion.
- Xpath10 number: Evaluate an XPath 1.0 numeric expression: arithmetic, div, mod, floor, ceiling, round, and number conversion.
- Xpath10 string: Evaluate an XPath 1.0 expression that yields a string, including concat, substring, translate, and string conversion.
- Xpath10 count: Count the nodes in an XPath 1.0 node-set from location paths, axes, predicates, namespaces and union.
- Xpath10 paths: List the canonical XPath 1.0 path of each node in a location-path node-set, in document order.
- Xpath10 select: Select an XPath 1.0 node-set from location paths, axes, predicates, namespaces and union, in document order.