Skip to main content
Glama

lowest_common_ancestor

Compute lowest common ancestors and distances in a tree with binary lifting to resolve ancestry and proximity queries.

Instructions

Find lowest common ancestors and distances in a tree using binary lifting.

Input Schema

NameRequiredDescriptionDefault
rootNoRoot vertex (default 0)
edgesYesTree edges as [u, v] pairs
queriesYesLCA queries as [u, v] pairs
vertex_countYesNumber of vertices (max 50,000)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It discloses the algorithm ('binary lifting') and that distances are returned, which is useful context, but omits output format, time complexity, and any constraints beyond what the schema already states.

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

Conciseness5/5

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

A single, front-loaded sentence with no filler. Every word contributes to understanding the tool's purpose and method.

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

Completeness3/5

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

The description adequately states the purpose and algorithm, and the input schema is fully documented. However, with no output schema, it should at least hint at the return format (e.g., per-query LCA and distance), which it does only implicitly.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents the four parameters. The description adds no further parameter detail, making the baseline score of 3 appropriate.

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?

The description states a specific verb ('Find'), resource ('lowest common ancestors and distances'), and context ('in a tree using binary lifting'). It is unambiguous and clearly distinguishable from the many sibling tools, none of which perform LCA.

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

Usage Guidelines2/5

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

No when-to-use guidance, no prerequisites, and no alternatives are mentioned. The description only states what the tool does, leaving the agent to infer when it is appropriate versus other tree or graph algorithms like heavy_light_decomposition.

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

Deploy Server

Other Tools