Skip to main content
Glama
GodisinHisHeaven

USCardForum MCP Server

get_current_session

Verify authentication status and retrieve current user information for USCardForum interactions. Check login status and access user details when authenticated.

Instructions

Get information about the current session.

Returns a Session object with:
- is_authenticated: Whether logged in
- current_user: CurrentUser object with user info (if authenticated)

Use to verify authentication status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
current_userNoLogged-in user
is_authenticatedNoWhether authenticated

Implementation Reference

  • The MCP tool handler function for 'get_current_session'. It uses the shared client instance to retrieve the current authentication session.
    @mcp.tool()
    def get_current_session() -> Session:
        """
        Get information about the current session.
    
        Returns a Session object with:
        - is_authenticated: Whether logged in
        - current_user: CurrentUser object with user info (if authenticated)
    
        Use to verify authentication status.
        """
        return get_client().get_current_session()
  • Pydantic model defining the structure of the Session object returned by the tool, including current_user and is_authenticated fields.
    class Session(BaseModel):
        """Current session information."""
    
        current_user: CurrentUser | None = Field(None, description="Logged-in user")
        is_authenticated: bool = Field(False, description="Whether authenticated")
    
        class Config:
            extra = "ignore"
    
        @classmethod
        def from_api_response(cls, data: dict[str, Any]) -> "Session":
            """Parse from raw API response."""
            user_data = data.get("current_user") or data.get("user")
            current_user = CurrentUser(**user_data) if user_data else None
            return cls(
                current_user=current_user,
                is_authenticated=current_user is not None,
            )
  • Core implementation in AuthAPI class that performs the HTTP request to fetch session data from the forum API.
    def get_current_session(self) -> Session:
        """Get current session info.
    
        Returns:
            Session data including user info (unauthenticated if no session)
        """
        try:
            payload = self._get("/session/current.json")
            return Session.from_api_response(payload)
        except requests.exceptions.HTTPError as e:
            # 404 means no session - return unauthenticated session
            if e.response is not None and e.response.status_code == 404:
                return Session(is_authenticated=False, current_user=None)
            raise
  • Wrapper method on the main DiscourseClient that delegates the get_current_session call to its internal AuthAPI instance.
    def get_current_session(self) -> Session:
        """Get current session info.
    
        Returns:
            Session data including user info
        """
        return self._auth.get_current_session()
  • Import of the get_current_session tool in server_tools __init__.py, making it available for re-export and server registration.
    from .auth import (
        login,
        get_current_session,
        get_notifications,
        bookmark_post,
        subscribe_topic,
    )
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 describes the return value (Session object with authentication and user info) and the tool's read-only nature (implied by 'Get'), but lacks details on behavioral traits like error handling, rate limits, or permissions required. This is adequate but has gaps for a tool with no annotations.

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 concise, with three sentences that each add value: stating the purpose, detailing the return object, and providing usage guidance. It's front-loaded with the main action and wastes no words, making it efficient for an AI agent.

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 (0 params, no annotations, but has an output schema), the description is fairly complete. It explains what the tool does and what it returns, and the output schema handles return values. However, it could benefit from more behavioral context like error cases, but it's sufficient for this simple tool.

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 0 parameters with 100% coverage, so no parameter info is needed. The description doesn't add param semantics, but that's fine since there are none. Baseline is 4 for 0 params, as it doesn't need to compensate for any gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 information about the current session.' It specifies the verb ('Get') and resource ('current session'), making it easy to understand what the tool does. However, it doesn't differentiate from siblings like 'login' or 'get_user_summary' that might also relate to authentication or user info, keeping it from a perfect score.

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 usage guidance with 'Use to verify authentication status,' indicating when to use this tool. It implies context for checking login status but doesn't explicitly state when not to use it or name alternatives like 'login' for authentication actions, which prevents a score of 5.

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