Skip to main content
Glama
ptorsten

humaans-mcp

by ptorsten

count_reports

Count direct or total reports for a person using their ID. Set recursive to true for full team size.

Instructions

Count reports for a person. recursive=False gives direct reports only; True gives the full subtree size.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
person_idYes
recursiveNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The count_reports async function is the handler for the tool. It counts direct reports (non-recursive mode) or the full recursive subtree of reports (recursive=True).
    async def count_reports(person_id: str, recursive: bool = False) -> dict[str, int]:
        """Count reports for a person. recursive=False gives direct reports only; True gives the full subtree size."""
        if not recursive:
            person = await client().get(f"/people/{person_id}")
            return {"direct": len(person.get("directReports") or [])}
    
        by_id, _, _ = await _people_index()
        if person_id not in by_id:
            raise ValueError(f"Person {person_id} not found")
    
        total = 0
        stack = list(by_id[person_id].get("directReports") or [])
        direct = len(stack)
        visited: set[str] = set()
        while stack:
            cur = stack.pop()
            if cur in visited or cur not in by_id:
                continue
            visited.add(cur)
            total += 1
            stack.extend(by_id[cur].get("directReports") or [])
    
        return {"direct": direct, "total_recursive": total}
  • The @mcp.tool() decorator registers count_reports as an MCP tool on the FastMCP instance.
    @mcp.tool()
  • The _people_index() helper is used by count_reports when recursive=True to build the full people index (by_id map) for traversing the org tree.
    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 client() helper returns the HumaansClient instance, used by count_reports in non-recursive mode to fetch the person record.
    def client() -> HumaansClient:
        global _client
        if _client is None:
            _client = HumaansClient()
        return _client
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It explains the recursive parameter's effect but does not explicitly state that the tool is read-only, safe, or any other behavioral traits beyond the count operation.

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 a single, front-loaded sentence with no wasted words. It efficiently conveys purpose and key parameter behavior.

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 that an output schema exists, the description does not need to detail return values. It covers the essential logic (recursive vs direct) and is complete for a simple counting tool, though it lacks error or prerequisite info.

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?

The description adds meaning to the 'recursive' parameter, which the schema does not describe (0% coverage). The 'person_id' is self-explanatory. The description compensates well for the schema's lack of parameter descriptions.

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 it counts reports for a person, with a specific verb ('count') and resource ('reports'). It differentiates the recursive behavior from siblings like get_direct_reports (which lists) and get_reporting_chain_down/up.

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 usage (e.g., use for summary counts) but does not explicitly state when to use this tool versus the listing tools available, such as get_direct_reports.

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