Skip to main content
Glama

get_groups

Retrieve all contact groups along with member counts for easy group management.

Instructions

Get contact groups.

Returns: List of groups with member counts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual implementation of the get_groups tool handler. It calls rtm.groups.getList API, processes groups and their contacts, and returns a formatted response with group id, name, and member_count.
    @mcp.tool()
    async def get_groups(ctx: Context) -> dict[str, Any]:
        """Get contact groups.
    
        Returns:
            List of groups with member counts
        """
        from ..client import RTMClient
    
        client: RTMClient = await get_client()
    
        result = await client.call("rtm.groups.getList")
    
        groups_data = result.get("groups", {}).get("group", [])
        if isinstance(groups_data, dict):
            groups_data = [groups_data]
    
        groups = []
        for group in groups_data:
            contacts = group.get("contacts", {}).get("contact", [])
            if isinstance(contacts, dict):
                contacts = [contacts]
    
            groups.append(
                {
                    "id": group.get("id"),
                    "name": group.get("name"),
                    "member_count": len(contacts),
                }
            )
    
        return build_response(
            data={
                "groups": groups,
                "count": len(groups),
            },
        )
  • Registration of utility tools including get_groups via register_utility_tools(mcp, get_client) function call.
    # Register all tools
    register_task_tools(mcp, get_client)
    register_list_tools(mcp, get_client)
    register_note_tools(mcp, get_client)
    register_utility_tools(mcp, get_client)
  • The build_response helper function used by get_groups to structure its response with data and metadata.
    def build_response(
        data: dict[str, Any] | list[Any],
        analysis: dict[str, Any] | None = None,
        transaction_id: str | None = None,
    ) -> dict[str, Any]:
        """Build a consistent response structure.
    
        Args:
            data: The main response data
            analysis: Optional analysis/insights
            transaction_id: Optional transaction ID for undo support
    
        Returns:
            Structured response dict
        """
        response = {
            "data": data,
            "metadata": {
                "fetched_at": datetime.now().isoformat(),
            },
        }
    
        if analysis:
            response["analysis"] = analysis
    
        if transaction_id:
            response["metadata"]["transaction_id"] = transaction_id
    
        return response
Behavior3/5

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

No annotations provided, but the description implies a read-only retrieval. More detail could be given (e.g., mentions it returns member counts) but remains acceptable.

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 concise sentences, front-loaded with purpose, no unnecessary words.

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?

With no parameters and an output schema present, the description sufficiently covers the tool's basic behavior and return value.

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?

No parameters exist; baseline score of 4 applies as schema coverage is 100% and description adds no extra param info.

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?

Description clearly states 'Get contact groups' with a specific verb and resource, distinguishing it from sibling tools like get_contacts or get_lists.

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 guidance on when to use this tool versus alternatives; lacks explicit context or exclusions.

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/ljadach/rtm-mcp'

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