Skip to main content
Glama
GodisinHisHeaven

USCardForum MCP Server

get_topic_info

Retrieve topic metadata to plan content reading, including post count, title, and timestamps, before fetching posts from USCardForum.

Instructions

Get metadata about a specific topic without fetching all posts.

Args:
    topic_id: The numeric topic ID (from URLs like /t/slug/12345)

Use this FIRST before reading a topic to:
- Check how many posts it contains (for pagination planning)
- Get the topic title and timestamps
- Decide whether to fetch all posts or paginate

Returns a TopicInfo object with:
- topic_id: The topic ID
- title: Full topic title
- post_count: Total number of posts
- highest_post_number: Last post number (may differ from count if posts deleted)
- last_posted_at: When the last reply was made

Strategy for large topics:
- <50 posts: Safe to fetch all at once
- 50-200 posts: Consider using max_posts parameter
- >200 posts: Fetch in batches or summarize key posts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topic_idYesThe numeric topic ID (from URLs like /t/slug/12345)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNoTopic title
topic_idYesTopic identifier
post_countNoTotal number of posts
last_posted_atNoLast activity time
highest_post_numberNoHighest post number

Implementation Reference

  • The MCP tool handler and registration for get_topic_info. This is the primary entrypoint for the tool, decorated with @mcp.tool(), which handles input validation via Annotated Field and delegates execution to the client.
    @mcp.tool()
    def get_topic_info(
        topic_id: Annotated[
            int,
            Field(description="The numeric topic ID (from URLs like /t/slug/12345)"),
        ],
    ) -> TopicInfo:
        """
        Get metadata about a specific topic without fetching all posts.
    
        Args:
            topic_id: The numeric topic ID (from URLs like /t/slug/12345)
    
        Use this FIRST before reading a topic to:
        - Check how many posts it contains (for pagination planning)
        - Get the topic title and timestamps
        - Decide whether to fetch all posts or paginate
    
        Returns a TopicInfo object with:
        - topic_id: The topic ID
        - title: Full topic title
        - post_count: Total number of posts
        - highest_post_number: Last post number (may differ from count if posts deleted)
        - last_posted_at: When the last reply was made
    
        Strategy for large topics:
        - <50 posts: Safe to fetch all at once
        - 50-200 posts: Consider using max_posts parameter
        - >200 posts: Fetch in batches or summarize key posts
        """
        return get_client().get_topic_info(topic_id)
  • Pydantic BaseModel defining the output schema for TopicInfo returned by get_topic_info.
    class TopicInfo(BaseModel):
        """Detailed topic metadata."""
    
        topic_id: int = Field(..., description="Topic identifier")
        title: str | None = Field(None, description="Topic title")
        post_count: int = Field(0, description="Total number of posts")
        highest_post_number: int = Field(0, description="Highest post number")
        last_posted_at: datetime | None = Field(None, description="Last activity time")
    
        class Config:
            extra = "ignore"
  • Core API helper function in TopicsAPI that performs the HTTP GET request to fetch topic metadata and parses it into TopicInfo model.
    def get_topic_info(self, topic_id: int) -> TopicInfo:
        """Fetch topic metadata.
    
        Args:
            topic_id: Topic ID
    
        Returns:
            Topic info with post count, title, timestamps
        """
        payload = self._get(f"/t/{int(topic_id)}.json")
        return TopicInfo(
            topic_id=topic_id,
            title=payload.get("title"),
            post_count=payload.get("posts_count", 0),
            highest_post_number=payload.get("highest_post_number", 0),
            last_posted_at=payload.get("last_posted_at"),
        )
  • Client wrapper method that delegates get_topic_info to the underlying TopicsAPI instance.
    def get_topic_info(self, topic_id: int) -> TopicInfo:
        """Fetch topic metadata.
    
        Args:
            topic_id: Topic ID
    
        Returns:
            Topic info with post count, title, timestamps
        """
        return self._topics.get_topic_info(topic_id)
  • Server entrypoint imports and exposes get_topic_info in __all__ for module-level access.
    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,
    )
    
    __all__ = [
        "MCP_HOST",
        "MCP_PORT",
        "MCP_TRANSPORT",
        "NITAN_TOKEN",
        "SERVER_INSTRUCTIONS",
        "get_client",
        "main",
        "mcp",
        "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",
        "resource_categories",
        "resource_hot_topics",
        "resource_new_topics",
        "search_forum",
        "subscribe_topic",
        "research_topic",
    ]
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior: it's a read-only operation (implied by 'Get metadata'), returns a TopicInfo object with specific fields, and includes practical advice on handling large topics (e.g., pagination strategies). It doesn't mention rate limits or auth needs, but covers key operational aspects well.

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 well-structured and front-loaded, starting with the core purpose, followed by args, usage guidelines, return values, and strategy. Every sentence adds value—no redundancy or fluff—making it efficient and easy to parse.

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's complexity (single parameter, read-only operation) and the presence of an output schema (which covers return values), the description is complete. It explains purpose, usage, parameters, and behavioral context without needing to detail return values, making it sufficient for an agent to use the tool effectively.

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 input schema has 100% description coverage, so the baseline is 3. The description adds value by explaining the parameter's source ('from URLs like /t/slug/12345') and its role in the tool's purpose, enhancing understanding beyond the schema's basic documentation. It doesn't add syntax details, but provides contextual meaning.

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's purpose: 'Get metadata about a specific topic without fetching all posts.' It uses a specific verb ('Get metadata') and resource ('specific topic'), and explicitly distinguishes it from sibling tools like 'get_all_topic_posts' and 'get_topic_posts' by emphasizing it doesn't fetch posts.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'Use this FIRST before reading a topic' for checking post count, title, timestamps, and deciding on fetching strategy. It distinguishes from alternatives by noting it's for metadata only, not for fetching posts, and offers a strategy for large topics with specific thresholds (<50, 50-200, >200 posts).

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

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