Skip to main content
Glama

check_auth_status

Verify authentication status for Bluesky Social sessions using environment variables to confirm login validity.

Instructions

Check if the current session is authenticated.

Authentication happens automatically using environment variables:
- BLUESKY_IDENTIFIER: Required - your Bluesky handle
- BLUESKY_APP_PASSWORD: Required - your app password
- BLUESKY_SERVICE_URL: Optional - defaults to https://bsky.social

Returns:
    Authentication status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'check_auth_status' tool. It attempts to retrieve an authenticated Bluesky client and returns the authentication status.
    @mcp.tool()
    def check_auth_status(ctx: Context) -> str:
        """Check if the current session is authenticated.
    
        Authentication happens automatically using environment variables:
        - BLUESKY_IDENTIFIER: Required - your Bluesky handle
        - BLUESKY_APP_PASSWORD: Required - your app password
        - BLUESKY_SERVICE_URL: Optional - defaults to https://bsky.social
    
        Returns:
            Authentication status
        """
        try:
            bluesky_client = get_authenticated_client(ctx)
            return f"Authenticated to {bluesky_client._base_url}"
        except ValueError as e:
            return f"Not authenticated: {str(e)}"
  • Helper function used by check_auth_status to obtain an authenticated Bluesky client, which calls login() if necessary.
    def get_authenticated_client(ctx: Context) -> Client:
        """Get an authenticated client, creating it lazily if needed.
    
        Args:
            ctx: MCP context
    
        Returns:
            Authenticated Client instance
    
        Raises:
            ValueError: If credentials are not available
        """
        app_context = ctx.request_context.lifespan_context
    
        # If we already have a client, return it
        if app_context.bluesky_client is not None:
            return app_context.bluesky_client
    
        # Try to create a new client by calling login again
        client = login()
        if client is None:
            raise ValueError(
                "Authentication required but credentials not available. "
                "Please set BLUESKY_IDENTIFIER and BLUESKY_APP_PASSWORD environment variables."
            )
    
        # Store it in the context for future use
        app_context.bluesky_client = client
        return client
  • login() helper function that creates and authenticates a Bluesky Client using environment variables.
    def login() -> Optional[Client]:
        """Login to Bluesky API and return the client.
    
        Authenticates using environment variables:
        - BLUESKY_IDENTIFIER: The handle (username)
        - BLUESKY_APP_PASSWORD: The app password
        - BLUESKY_SERVICE_URL: The service URL (defaults to "https://bsky.social")
    
        Returns:
            Authenticated Client instance or None if credentials are not available
        """
        handle = os.environ.get("BLUESKY_IDENTIFIER")
        password = os.environ.get("BLUESKY_APP_PASSWORD")
        service_url = os.environ.get("BLUESKY_SERVICE_URL", "https://bsky.social")
    
        if not handle or not password:
            return None
    
        # This is helpful for debugging.
        # print(f"LOGIN {handle=} {service_url=}", file=sys.stderr)
    
        # Create and authenticate client
        client = Client(service_url)
        client.login(handle, password)
        return client
  • server.py:1074-1075 (registration)
    The tool is listed under 'authentication' category in the tools info resource.
    "authentication": ["check_environment_variables", "check_auth_status"],
    "profiles": ["get_profile", "get_follows", "get_followers", "follow_user"],
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 explains that authentication is automatic via environment variables, lists the required and optional variables, and mentions the return value (authentication status). However, it lacks details on error handling or specific status formats, leaving some behavioral aspects unclear.

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 front-loaded with the core purpose in the first sentence, followed by necessary details about authentication and returns. Each sentence adds essential information without redundancy, making it efficient and well-structured for quick understanding.

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 simplicity (0 parameters, no output schema, no annotations), the description is largely complete, covering purpose, usage, and behavioral context. However, it could be more detailed on the return format (e.g., what 'Authentication status' entails) to fully compensate for the lack of output schema, leaving minor gaps.

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 tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description adds value by explaining the authentication mechanism (environment variables) and the return type, which goes beyond the empty input schema, making it more informative for users.

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 specific verb ('Check') and resource ('if the current session is authenticated'), distinguishing it from all sibling tools which perform actions like deleting posts, following users, or retrieving content. It precisely defines what the tool does without being vague or tautological.

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 verify authentication status) and implies prerequisites (environment variables must be set), but it does not explicitly state when not to use it or name alternatives. This makes it helpful but not fully comprehensive for decision-making.

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/gwbischof/bluesky-social-mcp'

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