Skip to main content
Glama
web-algebra-mcp

web-algebra-mcp

Official
by AtomGraph

Substitute

Binds a value to a SPARQL variable with an inline VALUES block, keeping the variable projected and the query valid instead of removing it.

Instructions

Gives one variable of a SPARQL query or update a value without removing the variable: an inline VALUES block restricting it to the term is joined into every group of the query, so the query stays valid, a SELECT still projects the variable and every result row still carries it. Subqueries that do not project the variable keep their own copy (it is renamed there). The query must not assign the variable itself (AS or VALUES). A URI is written as , a literal escaped; a blank node is rejected. Substitute is Values over a one-row table; use Values for several variables or rows. For example, Substitute("SELECT ?city ?label WHERE { ?city rdfs:label ?label }", "city", URI("http://ex.org/C")) produces "SELECT ?city ?label WHERE { VALUES (?city) { (http://ex.org/C) } ?city rdfs:label ?label }".

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>",
      "var": "<var>",
      "binding": "<binding>"
    },
    "name": "Substitute"
  }
}

Input Schema

NameRequiredDescriptionDefault
varYesThe variable to substitute in the query (e.g., '?x').
queryYesThe SPARQL query string with variable placeholders.
bindingYesA dictionary containing the value and type to substitute for the variable.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.4

TDQS

A4.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are supplied, so the description carries the full behavioral burden, and it does a lot: it explains the VALUES injection, that subqueries not projecting the variable are renamed rather than rewritten, and that blank nodes are rejected. What it does not cover is error/failure behavior beyond the AS/VALUES restriction and whether the result is a plain string or a structured object. The 'bnode' value permitted by the schema but rejected per the description is a schema inconsistency the description usefully flags rather than a contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core definition and the Values comparison before the worked example, with no filler sentences. It runs long and the inline example is verbose, but nearly every clause carries operational information rather than restating the name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a query-rewriting tool with no output schema and a nested binding object, the description supplies the transformation rule, the projection-preservation guarantee, the subquery edge case, the input restrictions, and a before/after example showing the exact return shape. Nothing essential for a correct first call appears to be missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning beyond the schema: a URI must be written as <iri>, a literal is escaped, a blank node is rejected, and the variable is given in '?x' form. Those are type-specific formatting rules an agent would otherwise get wrong from the bare enum.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Gives one variable of a SPARQL query or update a value without removing the variable') and immediately clarifies the mechanism (inline VALUES joined into every group). It explicitly differentiates itself from the sibling Values tool, so an agent can choose between them without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit routing guidance: 'Substitute is Values over a one-row table; use Values for several variables or rows.' It also states preconditions — the query must not already assign the variable via AS or VALUES — which tells the agent when this tool will fail rather than succeed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.