Skip to main content
Glama
ptorsten

humaans-mcp

by ptorsten

get_reporting_chain_up

Trace an employee's reporting chain upward from themselves to the top of the organization. Returns an ordered list ending with the highest manager.

Instructions

Walk the management chain upward from the given person. Returns an ordered list starting with the person and ending at the top of the chain (someone with no manager).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
person_idYes
max_depthNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual handler function for the get_reporting_chain_up tool. It walks the management chain upward from a given person by building a child→parent index from the full people list, then iterates from the person up to the top (someone with no manager).
    @mcp.tool()
    async def get_reporting_chain_up(person_id: str, max_depth: int = 20) -> list[dict[str, Any]]:
        """Walk the management chain upward from the given person. Returns an ordered list starting with the person and ending at the top of the chain (someone with no manager)."""
        by_id, parent_of, custom_by_person = await _people_index()
        chain: list[dict[str, Any]] = []
        seen: set[str] = set()
        current: str | None = person_id
        while current and current not in seen and len(chain) < max_depth:
            seen.add(current)
            person = by_id.get(current)
            if person is None:
                break
            chain.append(_person_summary(person, custom_by_person.get(current)))
            current = parent_of.get(current)
        return chain
  • The tool is registered via the @mcp.tool() decorator on the async function. 'mcp' is a FastMCP instance defined at line 7.
    @mcp.tool()
  • The _people_index() helper builds the data structures used by get_reporting_chain_up: by_id (person id → person dict), parent_of (report id → manager id from the directReports array), and custom_by_person (person id → custom field values).
    async def _people_index() -> tuple[dict[str, dict[str, Any]], dict[str, str], dict[str, dict[str, Any]]]:
        """Return (by_id, parent_of, custom_by_person). parent_of maps a report's id to their manager's id; custom_by_person maps personId to {fieldName: value}."""
        all_people = await client().list_all("/people")
        by_id = {p["id"]: p for p in all_people if "id" in p}
        parent_of: dict[str, str] = {}
        for p in all_people:
            mgr_id = p.get("id")
            for child_id in p.get("directReports") or []:
                parent_of[child_id] = mgr_id
    
        names = await _custom_field_names()
        all_values = await client().list_all("/custom-values")
        values_by_person: dict[str, list[dict[str, Any]]] = {}
        for v in all_values:
            pid = v.get("personId")
            if pid:
                values_by_person.setdefault(pid, []).append(v)
        custom_by_person = {
            pid: _resolve_custom(vs, names) for pid, vs in values_by_person.items()
        }
    
        return by_id, parent_of, custom_by_person
  • The _person_summary() helper creates a summary dict for each person in the chain, merging custom field values with core identity fields.
    def _person_summary(p: dict[str, Any], custom: dict[str, Any] | None = None) -> dict[str, Any]:
        return {
            **(custom or {}),
            "id": p.get("id"),
            "firstName": p.get("firstName"),
            "lastName": p.get("lastName"),
            "jobTitle": p.get("jobTitle"),
            "email": p.get("email"),
            "contractType": p.get("contractType"),
        }
  • The input schema is defined by the function signature: person_id (str, required) and max_depth (int, optional, default 20). The return type is list[dict[str, Any]].
    async def get_reporting_chain_up(person_id: str, max_depth: int = 20) -> list[dict[str, Any]]:
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It mentions the output structure but omits details about error handling, behavior on invalid person_id, or what happens when max_depth is reached. The description lacks sufficient behavioral disclosure.

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?

The description is concise: two sentences with no wasted words. It front-loads the action and clearly describes the output. Every sentence adds value.

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?

Given the tool's simplicity and presence of an output schema, the description covers the core behavior. However, it omits parameter details (especially max_depth) and does not address edge cases or error conditions. It is minimally complete but could be more thorough.

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

Parameters2/5

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

With 0% schema description coverage, the description must explain parameters. It implicitly covers person_id as 'the given person' but does not explain max_depth or its default value. Both parameters are not fully clarified beyond the schema definition.

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 clearly states the tool walks the management chain upward from a given person and returns an ordered list ending at the top. This distinguishes it from siblings like get_reporting_chain_down and count_reports.

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

Usage Guidelines3/5

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

The description implies when to use this tool (to get the upward chain), but does not provide explicit guidance on when not to use it or compare with alternatives. No exclusions or context for selection among siblings.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ptorsten/humaans-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server