Skip to main content
Glama
hmumixaM

USCardForum MCP Server

by hmumixaM

get_user_badges

Retrieve user badges to assess participation, community recognition, and special achievements for trustworthiness evaluation.

Instructions

Fetch badges earned by a user.

Args:
    username: The user's handle
    grouped: Group badges by type (default: True)

Returns a UserBadges object with:
- badges: List of Badge objects with name, description, granted_at
- badge_types: Badge type information

Badges indicate:
- Participation milestones (first post, anniversaries)
- Community recognition (editor, leader)
- Special achievements

Use to assess user experience and trustworthiness.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesThe user's handle
groupedNoGroup badges by type (default: True)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
badgesNoEarned badges
badge_typesNoBadge type info

Implementation Reference

  • MCP tool handler for get_user_badges. Defines input schema via Annotated Fields (username: str, grouped: bool=True). Includes detailed docstring for usage. Delegates execution to DiscourseClient.get_user_badges.
    @mcp.tool()
    def get_user_badges(
        username: Annotated[
            str,
            Field(description="The user's handle"),
        ],
        grouped: Annotated[
            bool,
            Field(default=True, description="Group badges by type (default: True)"),
        ] = True,
    ) -> UserBadges:
        """
        Fetch badges earned by a user.
    
        Args:
            username: The user's handle
            grouped: Group badges by type (default: True)
    
        Returns a UserBadges object with:
        - badges: List of Badge objects with name, description, granted_at
        - badge_types: Badge type information
    
        Badges indicate:
        - Participation milestones (first post, anniversaries)
        - Community recognition (editor, leader)
        - Special achievements
    
        Use to assess user experience and trustworthiness.
        """
        return get_client().get_user_badges(username, grouped=grouped)
  • Input schema defined by Pydantic Annotated parameters with Field descriptions and defaults. Output typed as UserBadges model.
    @mcp.tool()
    def get_user_badges(
        username: Annotated[
            str,
            Field(description="The user's handle"),
        ],
        grouped: Annotated[
            bool,
            Field(default=True, description="Group badges by type (default: True)"),
        ] = True,
    ) -> UserBadges:
        """
        Fetch badges earned by a user.
    
        Args:
            username: The user's handle
            grouped: Group badges by type (default: True)
    
        Returns a UserBadges object with:
        - badges: List of Badge objects with name, description, granted_at
        - badge_types: Badge type information
    
        Badges indicate:
        - Participation milestones (first post, anniversaries)
        - Community recognition (editor, leader)
        - Special achievements
    
        Use to assess user experience and trustworthiness.
        """
        return get_client().get_user_badges(username, grouped=grouped)
  • Re-exports get_user_badges tool from users.py module, making it available at package level for server import.
    from .users import (
        get_user_summary,
        get_user_topics,
        get_user_replies,
        get_user_actions,
        get_user_badges,
        get_user_following,
        get_user_followers,
        get_user_reactions,
  • Imports get_user_badges into main server entrypoint module, registering it for the MCP server via FastMCP.
    from uscardforum.server_tools import (
        analyze_user,
        bookmark_post,
        compare_cards,
        find_data_points,
        get_all_topic_posts,
        get_categories,
        get_current_session,
        get_hot_topics,
        get_new_topics,
        get_notifications,
        get_top_topics,
        get_topic_info,
        get_topic_posts,
        get_user_actions,
        get_user_badges,
        get_user_followers,
        get_user_following,
        get_user_reactions,
        get_user_replies,
        get_user_summary,
        get_user_topics,
        list_users_with_badge,
        login,
        research_topic,
        resource_categories,
        resource_hot_topics,
        resource_new_topics,
        search_forum,
        subscribe_topic,
    )
  • Underlying API helper that performs HTTP request to Discourse /user-badges/{username}.json endpoint, parses badges from JSON response into UserBadges model.
    def get_user_badges(
        self,
        username: str,
        grouped: bool = True,
    ) -> UserBadges:
        """Fetch user's badges.
    
        Args:
            username: User handle
            grouped: Group badges (default: True)
    
        Returns:
            User badges data
        """
        params_list: list[tuple[str, Any]] = [
            ("grouped", str(bool(grouped)).lower())
        ]
        payload = self._get(f"/user-badges/{username}.json", params=params_list)
    
        badges = []
        for b in payload.get("user_badges", []):
            badges.append(Badge(
                id=b.get("id", 0),
                badge_id=b.get("badge_id", 0),
                name=b.get("name", ""),
                description=b.get("description"),
                granted_at=b.get("granted_at"),
            ))
    
        return UserBadges(badges=badges)
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 discloses that the tool fetches data (implied read-only) and describes the return structure, but lacks details on behavioral traits like error handling, rate limits, authentication needs, or whether it's idempotent. The description adds some context about badge types but misses key operational aspects.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose. However, the 'Args' section repeats schema info unnecessarily, and the 'Badges indicate' and 'Use to assess' sections, while helpful, could be more integrated. It's efficient but has minor structural redundancy.

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 the tool's low complexity (2 parameters, 1 required), 100% schema coverage, and the presence of an output schema (implied by 'Returns a UserBadges object'), the description is mostly complete. It explains the purpose, usage context, and return structure, though it lacks behavioral details like error cases or performance considerations.

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 already documents both parameters fully. The description repeats the parameter info in the 'Args' section without adding meaning beyond the schema (e.g., explaining why grouping matters or format details). This meets the baseline of 3 when schema coverage is high.

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 verb 'fetch' and resource 'badges earned by a user', making the purpose specific. It distinguishes from siblings like 'list_users_with_badge' (which lists users with a badge) by focusing on badges for a specific user, and from 'get_user_summary' by targeting badges specifically rather than general user data.

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 provides clear context for when to use this tool: 'to assess user experience and trustworthiness' based on badges indicating participation, community recognition, and special achievements. However, it does not explicitly state when not to use it or name alternatives (e.g., 'get_user_summary' for broader user info), which prevents a perfect score.

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/hmumixaM/uscardforum-mcp4'

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