Skip to main content
Glama
ptorsten

humaans-mcp

by ptorsten

get_reporting_chain_down

Retrieve the complete reporting chain downward from a specified person, expanding direct reports up to a given maximum depth.

Instructions

Build the subtree of reports under the given person, up to max_depth levels. Uses a single fetch of all people then walks directReports locally.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
person_idYes
max_depthNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'get_reporting_chain_down' tool. It fetches all people, builds a subtree of reports under the given person recursively using the 'directReports' field, up to max_depth levels. Decorated with @mcp.tool() to register as an MCP tool.
    @mcp.tool()
    async def get_reporting_chain_down(person_id: str, max_depth: int = 5) -> dict[str, Any]:
        """Build the subtree of reports under the given person, up to max_depth levels. Uses a single fetch of all people then walks `directReports` locally."""
        by_id, _, custom_by_person = await _people_index()
        root = by_id.get(person_id)
        if root is None:
            raise ValueError(f"Person {person_id} not found")
    
        def build(node: dict[str, Any], depth: int) -> dict[str, Any]:
            summary = _person_summary(node, custom_by_person.get(node.get("id") or ""))
            child_ids = node.get("directReports") or []
            if depth >= max_depth:
                summary["reports"] = (
                    f"<{len(child_ids)} more, increase max_depth to expand>"
                    if child_ids
                    else []
                )
                return summary
            summary["reports"] = [
                build(by_id[cid], depth + 1) for cid in child_ids if cid in by_id
            ]
            return summary
    
        return build(root, 0)
  • Registration of the tool via the @mcp.tool() decorator on line 195, which registers get_reporting_chain_down with the FastMCP server instance.
    @mcp.tool()
  • Helper function _person_summary used by the handler to produce a summary dict for each person node in the tree.
    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"),
        }
  • Helper function _people_index used by the handler to fetch and index all people by ID along with custom field data.
    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 FastMCP server instance used for registration. The @mcp.tool() decorator registers tools on this instance.
    mcp = FastMCP("humaans")
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses the internal mechanism (single fetch then local walk), which is good transparency. However, it does not discuss error handling or performance with large data.

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?

Two sentences, front-loaded with purpose, no waste. Efficient and clear.

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

Completeness4/5

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

Given output schema exists and moderate complexity, description explains the process adequately. It differentiates from siblings but lacks performance caveats. Still fairly complete for the task.

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 coverage is 0%, so description must add meaning. It mentions depth via max_depth but does not explicitly state the default of 5 or that it's optional. person_id is clear. Some additional context on usage would improve it.

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 builds a subtree of reports under a given person up to max_depth levels. It distinguishes itself from siblings like get_direct_reports and get_reporting_chain_up by focusing on the downward subtree.

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

Usage Guidelines4/5

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

The description implies when to use (subtree vs direct reports) but does not explicitly state when not to use or mention alternatives. The implementation note suggests efficiency, but no exclusions are given.

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