Skip to main content
Glama
hmumixaM

USCardForum MCP Server

by hmumixaM

get_topic_info

Retrieve topic metadata to plan pagination and content fetching for USCardForum discussions. Check post count, title, and timestamps before reading full content.

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 primary MCP tool handler for 'get_topic_info'. Defined with @mcp.tool() decorator, includes input schema via Annotated[int, Field()], detailed docstring, and delegates to client API.
    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 model defining the output schema (TopicInfo) returned by the get_topic_info tool.
    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"
  • Import of get_topic_info from topics.py into server_tools package, making it available for export to server.py.
    from .topics import get_topic_info, get_topic_posts, get_all_topic_posts
  • Import of get_topic_info into the main server.py entrypoint, where all MCP tools are collected and exposed.
    get_topic_info,
  • Underlying API helper method in TopicsAPI that implements the core logic: HTTP GET to /t/{topic_id}.json and constructs TopicInfo from response.
    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"),
        )
Behavior4/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 behavioral traits such as the tool's role in pagination planning, decision-making for fetching posts, and handling of large topics with specific thresholds. However, it lacks details on error handling, rate limits, or authentication needs, which are common for API tools.

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 well-structured with clear sections (Args, Use this FIRST, Returns, Strategy), but it could be more concise by avoiding repetition (e.g., the topic_id explanation is duplicated in Args and schema). Most sentences earn their place by adding useful context, though some trimming is possible.

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, no annotations, but with an output schema), the description is complete. It explains the purpose, usage, parameters, return values (with a TopicInfo object detailed), and strategic advice, compensating for the lack of annotations. The output schema means return values don't need further explanation.

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?

Schema description coverage is 100%, so the baseline is 3. The description adds value by explaining the parameter's origin ('from URLs like /t/slug/12345') and its purpose in the context of the tool's usage, but it doesn't provide additional syntax or format details beyond what the schema already covers.

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 with a specific verb ('Get metadata') and resource ('about a specific topic'), distinguishing it from siblings like 'get_topic_posts' or 'get_all_topic_posts' by emphasizing it fetches metadata without posts. It explicitly differentiates from alternatives by stating 'without fetching all 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') and includes detailed strategies for different scenarios (e.g., 'Safe to fetch all at once' for <50 posts). It contrasts with siblings by implying this is a preliminary step before fetching posts, offering clear alternatives like pagination or batching.

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