Skip to main content
Glama

get_current_user

Retrieve authenticated user information from Yuque, including user ID, username, and avatar details for account management.

Instructions

获取当前认证用户的信息,包括用户ID、用户名、头像等语雀账号基本信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accessTokenNo用于认证 API 请求的令牌

Implementation Reference

  • The main execution handler for the 'get_current_user' tool. It instantiates YuqueService, calls getCurrentUser(), logs the result, and returns the user data as structured text content or an error message.
    async ({ accessToken }) => {
      try {
        Logger.log("Fetching current user information");
        const yuqueService = this.createYuqueService(accessToken);
        const user = await yuqueService.getCurrentUser();
    
        Logger.log(`Successfully fetched user: ${user.name}`);
        Logger.log(JSON.stringify(user));
        return {
          content: [{ type: "text", text: JSON.stringify(user) }],
        };
      } catch (error) {
        Logger.error("Error fetching current user:", error);
        return {
          content: [
            { type: "text", text: `Error fetching current user: ${error}` },
          ],
        };
      }
    }
  • Zod input schema defining the optional 'accessToken' parameter for tool authentication.
    {
      accessToken: z.string().optional().describe("用于认证 API 请求的令牌"),
    },
  • src/server.ts:133-159 (registration)
    The full MCP tool registration call in registerTools(), including name, description, input schema, and handler function.
    this.server.tool(
      "get_current_user",
      "获取当前认证用户的信息,包括用户ID、用户名、头像等语雀账号基本信息",
      {
        accessToken: z.string().optional().describe("用于认证 API 请求的令牌"),
      },
      async ({ accessToken }) => {
        try {
          Logger.log("Fetching current user information");
          const yuqueService = this.createYuqueService(accessToken);
          const user = await yuqueService.getCurrentUser();
    
          Logger.log(`Successfully fetched user: ${user.name}`);
          Logger.log(JSON.stringify(user));
          return {
            content: [{ type: "text", text: JSON.stringify(user) }],
          };
        } catch (error) {
          Logger.error("Error fetching current user:", error);
          return {
            content: [
              { type: "text", text: `Error fetching current user: ${error}` },
            ],
          };
        }
      }
    );
  • Helper method in YuqueService class that performs the actual API request to retrieve the current user's data from Yuque API.
    async getCurrentUser(): Promise<YuqueUser> {
      const response = await this.client.get('/user');
      return response.data.data;
    }
  • TypeScript interface defining the structure of the user object returned by the tool implementation.
    export interface YuqueUser {
      id: number;
      type?: string;
      login: string;
      name: string;
      description: string;
      avatar_url: string;
      books_count?: number;
      public_books_count?: number;
      followers_count?: number;
      following_count?: number;
      public?: number;
      created_at: string;
      updated_at: string;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions authentication ('当前认证用户') which aligns with the accessToken parameter, but doesn't describe what happens without authentication, rate limits, error conditions, or response format. For a tool with authentication requirements and no annotations, this leaves significant behavioral gaps.

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 a single, efficient sentence that front-loads the core purpose. It wastes no words and directly communicates what the tool does. However, it could be slightly more structured by separating authentication requirements from returned data.

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?

Given the tool's moderate complexity (authentication required, returns user data), no annotations, and no output schema, the description is minimally adequate. It covers the basic purpose and data returned but lacks details about authentication flow, error handling, and response structure that would be helpful for an agent.

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?

Schema description coverage is 100% with one parameter (accessToken) fully documented in the schema. The description adds minimal value beyond the schema by implying authentication context ('当前认证用户'), but doesn't provide additional syntax, format, or usage details for the parameter. Baseline 3 is appropriate when schema does the heavy lifting.

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 current authenticated user information) with specific resources listed (user ID, username, avatar, basic Yuque account information). It distinguishes from siblings by focusing on current user data rather than documents, groups, or repositories. However, it doesn't explicitly contrast with potential similar tools like 'get_user_docs'.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this tool is appropriate compared to other user-related tools (like 'get_user_docs' or 'get_user_repos'), nor does it specify prerequisites or context requirements beyond the implied authentication.

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/HenryHaoson/Yuque-MCP-Server'

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