Skip to main content
Glama
rhettlong

USCardForum MCP Server

by rhettlong

get_top_topics

Fetch top-performing credit card and points discussions from USCardForum for specific time periods like daily, weekly, or monthly to identify trending and historically valuable content.

Instructions

Fetch top-performing topics for a specific time period.

Args:
    period: Time window for ranking. Must be one of:
        - "daily": Top topics from today
        - "weekly": Top topics this week
        - "monthly": Top topics this month (default)
        - "quarterly": Top topics this quarter
        - "yearly": Top topics this year
    page: Page number for pagination (0-indexed). Use page=1 to get more topics.

Use this to:
- Find the most valuable discussions in a time range
- Research historically important threads
- Identify evergreen popular content

Returns TopicSummary objects sorted by engagement score.

Example: Use "yearly" to find the most impactful discussions,
or "daily" to see what's trending today.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNoTime window for ranking: 'daily', 'weekly', 'monthly' (default), 'quarterly', or 'yearly'monthly
pageNoPage number for pagination (0-indexed, default: 0)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Primary MCP tool handler for get_top_topics. Defines input parameters with validation and descriptions (schema). Executes by calling the shared DiscourseClient instance.
    @mcp.tool()
    def get_top_topics(
        period: Annotated[
            str,
            Field(
                default="monthly",
                description="Time window for ranking: 'daily', 'weekly', 'monthly' (default), 'quarterly', or 'yearly'",
            ),
        ] = "monthly",
        page: Annotated[
            int | None,
            Field(default=None, description="Page number for pagination (0-indexed, default: 0)"),
        ] = None,
    ) -> list[TopicSummary]:
        """
        Fetch top-performing topics for a specific time period.
    
        Args:
            period: Time window for ranking. Must be one of:
                - "daily": Top topics from today
                - "weekly": Top topics this week
                - "monthly": Top topics this month (default)
                - "quarterly": Top topics this quarter
                - "yearly": Top topics this year
            page: Page number for pagination (0-indexed). Use page=1 to get more topics.
    
        Use this to:
        - Find the most valuable discussions in a time range
        - Research historically important threads
        - Identify evergreen popular content
    
        Returns TopicSummary objects sorted by engagement score.
    
        Example: Use "yearly" to find the most impactful discussions,
        or "daily" to see what's trending today.
        """
        return get_client().get_top_topics(period=period, page=page)
  • Pydantic model defining the output schema for get_top_topics (list[TopicSummary]). Used for response serialization and validation.
    class TopicSummary(BaseModel):
        """Summary of a topic for list views (hot, new, top topics)."""
    
        id: int = Field(..., description="Unique topic identifier")
        title: str = Field(..., description="Topic title")
        posts_count: int = Field(0, description="Total number of posts")
        views: int = Field(0, description="Total view count")
        like_count: int = Field(0, description="Total likes on the topic")
        category_id: int | None = Field(None, description="Category identifier")
        category_name: str | None = Field(None, description="Category name")
        created_at: datetime | None = Field(None, description="When topic was created")
        last_posted_at: datetime | None = Field(None, description="Last activity time")
    
        class Config:
            extra = "ignore"
  • Explicit import of all server tools including get_top_topics into the server entrypoint module. Triggers auto-registration of @mcp.tool() decorated functions when mcp.run() is called.
    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,
    )
  • Core API helper that performs the HTTP GET request to /top.json endpoint, parses response, and constructs TopicSummary objects. Called by client.get_top_topics().
    def get_top_topics(
        self, period: str = "monthly", *, page: int | None = None
    ) -> list[TopicSummary]:
        """Fetch top topics for a time period.
    
        Args:
            period: One of 'daily', 'weekly', 'monthly', 'quarterly', 'yearly'
            page: Page number for pagination (0-indexed, default: 0)
    
        Returns:
            List of top topic summaries
        """
        allowed = {"daily", "weekly", "monthly", "quarterly", "yearly"}
        if period not in allowed:
            raise ValueError(f"period must be one of {sorted(list(allowed))}")
    
        params: dict[str, Any] = {"period": period}
        if page is not None:
            params["page"] = int(page)
    
        payload = self._get(
            "/top.json",
            params=params,
            headers={"Accept": "application/json, text/plain, */*"},
        )
        topics = payload.get("topic_list", {}).get("topics", [])
        return [TopicSummary(**t) for t in topics]
  • Client wrapper method that calls TopicsAPI.get_top_topics() and enriches results with category names.
    def get_top_topics(
        self, period: str = "monthly", *, page: int | None = None
    ) -> list[TopicSummary]:
        """Fetch top topics for a time period.
    
        Args:
            period: One of 'daily', 'weekly', 'monthly', 'quarterly', 'yearly'
            page: Page number for pagination (0-indexed, default: 0)
    
        Returns:
            List of top topic summaries
        """
        topics = self._topics.get_top_topics(period=period, page=page)
        return self._enrich_with_categories(topics)
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it describes the return format (TopicSummary objects), sorting behavior (by engagement score), and pagination mechanics (0-indexed). It could improve by mentioning rate limits or authentication requirements.

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?

Perfectly structured and appropriately sized: purpose statement first, then parameter details, usage guidelines, return information, and examples. Every sentence serves a distinct purpose with zero wasted words, and the information is well-organized for quick comprehension.

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

Completeness5/5

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

Given the tool has an output schema (so return values don't need explanation), 100% schema coverage, and no annotations, the description provides excellent completeness: it covers purpose, parameters, usage scenarios, return format, sorting behavior, and includes helpful examples. Nothing essential is missing.

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 baseline is 3. The description adds some value by providing concrete examples of period values and explaining what each represents, but doesn't add significant semantic meaning beyond what's already in the well-documented schema.

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 'top-performing topics' with the specific scope 'for a specific time period'. It distinguishes from siblings like get_hot_topics or get_new_topics by emphasizing performance ranking over recency or popularity metrics.

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 'Use this to:' section provides clear context for when to use this tool (finding valuable discussions, researching historical threads, identifying evergreen content). However, it doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools.

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/rhettlong/uscardforum-mcp'

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