Skip to main content
Glama

yapi_get_project

Retrieve YApi project details including name, description, and member information using the project ID to access API documentation platform data.

Instructions

获取YApi项目的基本信息,包括项目名称、描述、成员等

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesYApi项目ID
tokenNo访问令牌(可选)

Implementation Reference

  • Handler function for the yapi_get_project tool. Fetches project information using YApiClient.getProjectInfo and returns it as formatted JSON text content or error message.
    async (args: { project_id: string; token?: string }) => {
      try {
        const projectInfo = await yapiClient.getProjectInfo(
          args.project_id,
          args.token
        );
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(projectInfo, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `错误: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for yapi_get_project tool using Zod validation for required project_id and optional token.
    {
      description: '获取YApi项目的基本信息,包括项目名称、描述、成员等',
      inputSchema: {
        project_id: z.string().describe('YApi项目ID'),
        token: z.string().optional().describe('访问令牌(可选)'),
      },
  • src/index.ts:495-531 (registration)
    Registration of the yapi_get_project tool on the MCP server, including name, description, input schema, and handler function.
    server.registerTool(
      'yapi_get_project',
      {
        description: '获取YApi项目的基本信息,包括项目名称、描述、成员等',
        inputSchema: {
          project_id: z.string().describe('YApi项目ID'),
          token: z.string().optional().describe('访问令牌(可选)'),
        },
      },
      async (args: { project_id: string; token?: string }) => {
        try {
          const projectInfo = await yapiClient.getProjectInfo(
            args.project_id,
            args.token
          );
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(projectInfo, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `错误: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • YApiClient helper method that makes the HTTP GET request to YApi's /api/project/get endpoint to retrieve project information.
    async getProjectInfo(projectId: string, token?: string): Promise<any> {
      try {
        const params: any = { id: projectId };
        
        // 优先使用传入的 token,其次使用实例的 token
        const finalToken = token || this.token;
        if (finalToken) {
          params.token = finalToken;
        }
    
        const response = await this.client.get('/api/project/get', { params });
    
        if (response.data.errcode !== 0) {
          throw new Error(response.data.errmsg || '获取项目信息失败');
        }
    
        return response.data.data;
      } catch (error) {
        this.handleError(error, '获取项目信息失败');
      }
    }
Behavior2/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 of behavioral disclosure. It states it 'gets' information, implying a read-only operation, but doesn't specify authentication needs (e.g., token usage), rate limits, or response format. This is a significant gap for a tool with no annotation coverage.

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 purpose and lists retrieved information. It avoids redundancy, though it could be slightly more structured by separating usage context.

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 (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the purpose but lacks behavioral details and usage guidelines, making it incomplete for optimal agent understanding without additional context.

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%, so the schema already documents both parameters ('project_id' and optional 'token'). The description adds no additional meaning beyond what the schema provides, such as explaining token usage or project_id format, resulting in the baseline score.

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 ('获取' meaning 'get') and resource ('YApi项目的基本信息' meaning 'basic information of YApi project'), specifying what information is retrieved (project name, description, members). It distinguishes from siblings like 'yapi_get_interface' by focusing on projects rather than interfaces, though it doesn't explicitly contrast them.

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 sibling tools like 'yapi_get_interface' or 'yapi_list_interfaces', nor does it specify prerequisites or exclusions, leaving usage context implied.

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/TStoneLee/mcp-yapi-server'

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