Skip to main content
Glama
brianellin

Bluesky MCP Server

by brianellin

get-profile

Retrieve a Bluesky user's profile by entering their handle, enabling access to key information via the Bluesky MCP Server for direct integration with AI assistants.

Instructions

Get a user's profile from Bluesky

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
handleYesThe handle of the user (e.g., alice.bsky.social)

Implementation Reference

  • The handler function for the 'get-profile' tool. It fetches the user's profile from Bluesky using AtpAgent.getProfile after cleaning the handle input, formats the profile information into a readable text summary, and returns it as an MCP success response. Handles errors appropriately.
      async ({ handle }) => {
        if (!agent) {
          return mcpErrorResponse("Not logged in. Please check your environment variables.");
        }
    
        try {
          const response = await agent.getProfile({ actor: cleanHandle(handle) });
          
          if (!response.success) {
            return mcpErrorResponse(`Failed to get profile for ${handle}.`);
          }
    
          const profile = response.data;
          
          let profileText = `Profile for ${profile.displayName || handle} (@${profile.handle})
    DID: ${profile.did}
    ${profile.description ? `Bio: ${profile.description}` : ''}
    Followers: ${profile.followersCount || 0}
    Following: ${profile.followsCount || 0}
    Posts: ${profile.postsCount || 0}
    ${profile.labels?.length ? `Labels: ${profile.labels.map((l: any) => l.val).join(', ')}` : ''}`;
    
          return mcpSuccessResponse(profileText);
        } catch (error) {
          return mcpErrorResponse(`Error fetching profile: ${error instanceof Error ? error.message : String(error)}`);
        }
      }
    );
  • src/index.ts:268-301 (registration)
    The server.tool call that registers the 'get-profile' tool on the MCP server, including the tool name, description, input schema, and references the handler function.
    server.tool(
      "get-profile",
      "Get a user's profile from Bluesky",
      {
        handle: z.string().describe("The handle of the user (e.g., alice.bsky.social)"),
      },
      async ({ handle }) => {
        if (!agent) {
          return mcpErrorResponse("Not logged in. Please check your environment variables.");
        }
    
        try {
          const response = await agent.getProfile({ actor: cleanHandle(handle) });
          
          if (!response.success) {
            return mcpErrorResponse(`Failed to get profile for ${handle}.`);
          }
    
          const profile = response.data;
          
          let profileText = `Profile for ${profile.displayName || handle} (@${profile.handle})
    DID: ${profile.did}
    ${profile.description ? `Bio: ${profile.description}` : ''}
    Followers: ${profile.followersCount || 0}
    Following: ${profile.followsCount || 0}
    Posts: ${profile.postsCount || 0}
    ${profile.labels?.length ? `Labels: ${profile.labels.map((l: any) => l.val).join(', ')}` : ''}`;
    
          return mcpSuccessResponse(profileText);
        } catch (error) {
          return mcpErrorResponse(`Error fetching profile: ${error instanceof Error ? error.message : String(error)}`);
        }
      }
    );
  • Zod input schema for the 'get-profile' tool, defining a required 'handle' parameter as a string with description.
    {
      handle: z.string().describe("The handle of the user (e.g., alice.bsky.social)"),
  • The cleanHandle utility function used in the get-profile handler to normalize the input handle by removing leading '@' if present and preserving DIDs.
    export function cleanHandle(input: string): string {
      if (!input) return '';
      
      // If it's a DID, return it as is
      if (input.startsWith('did:')) {
        return input;
      }
      
      // If it has a leading @, remove it
      if (input.startsWith('@')) {
        return input.substring(1);
      }
      
      // Otherwise return as is
      return input;

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.1/5.0
Behavior2/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 only states the basic action ('Get a user's profile') but does not mention return format, authentication needs, rate limits, or error conditions. This is minimal but not misleading.

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 a single concise sentence that is front-loaded with the action and resource. It is appropriately sized for a simple tool with one parameter, and every word is useful. There is no wasted or redundant text.

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

Completeness3/5

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

For a straightforward getter with one parameter and no output schema, the description is minimally viable. It tells the user what the tool does, and the schema documents the parameter. However, it lacks detail about what exactly is included in the profile and when to prefer this over sibling tools, leaving some gaps.

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?

The schema description for 'handle' is clear and complete, covering 100% of parameters. The description adds no additional parameter meaning, but the baseline for high schema coverage is 3, and the schema already provides sufficient semantics.

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 action ('Get') and the resource ('user's profile') with a specified context ('from Bluesky'). It is unambiguous and distinct from siblings like get-my-handle-and-did or search-people, though it does not explicitly call out those alternatives.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. It does not mention that it is preferred for fetching a specific profile by handle, nor does it exclude use cases like searching for people. The description offers no selection context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.