Skip to main content
Glama

create_repository

Create a Gitee repository with customizable settings, including name, description, privacy, issue tracking, wiki, initialization, and templates for Git Ignore and License.

Instructions

创建 Gitee 仓库

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
auto_initNoWhether to automatically initialize the repository
descriptionNoRepository description
gitignore_templateNoGit Ignore template
has_issuesNoWhether to enable Issue functionality
has_wikiNoWhether to enable Wiki functionality
homepageNoHomepage URL
license_templateNoLicense template
nameYesRepository name
pathNoRepository path
privateNoWhether the repository is private

Implementation Reference

  • Core handler function that performs the HTTP POST request to Gitee API to create a repository.
    export async function createRepository(options: CreateRepositoryOptions) {
      try {
        console.log('Creating repository parameters:', JSON.stringify(options));
        const url = "/user/repos";
        const response = await giteeRequest(url, "POST", options);
        console.log('Create repository response:', JSON.stringify(response));
    
        // Try to parse the response
        try {
          return GiteeRepositorySchema.parse(response);
        } catch (parseError) {
          console.error('Failed to parse repository response:', parseError);
          // Return the original response to avoid parsing errors
          return response;
        }
      } catch (error) {
        console.error('Failed to create repository request:', error);
        throw error;
      }
    }
  • Zod schema defining the input parameters for the create_repository tool.
    export const CreateRepositorySchema = z.object({
      // 仓库名称
      name: z.string().describe("Repository name"),
      // 仓库描述
      description: z.string().optional().describe("Repository description"),
      // 主页地址
      homepage: z.string().optional().describe("Homepage URL"),
      // 是否私有
      private: z.boolean().default(false).optional().describe("Whether the repository is private"),
      // 是否开启 Issue 功能
      has_issues: z.boolean().default(true).optional().describe("Whether to enable Issue functionality"),
      // 是否开启 Wiki 功能
      has_wiki: z.boolean().default(true).optional().describe("Whether to enable Wiki functionality"),
      // 是否自动初始化仓库
      auto_init: z.boolean().default(false).optional().describe("Whether to automatically initialize the repository"),
      // Git Ignore 模板
      gitignore_template: z.string().optional().describe("Git Ignore template"),
      // License 模板
      license_template: z.string().optional().describe("License template"),
      // 仓库路径
      path: z.string().optional().describe("Repository path"),
    });
  • index.ts:22-49 (registration)
    Tool registration in the MCP server, including a wrapper handler that preprocesses parameters before calling the core createRepository function.
    server.registerTool({
      name: "create_repository",
      description: "创建 Gitee 仓库",
      schema: repoOperations.CreateRepositorySchema,
      handler: async (params: any) => {
        try {
          // 确保 private 参数是布尔值
          if (params.private !== undefined) {
            if (typeof params.private === 'string') {
              // 将字符串转换为布尔值
              params.private = params.private.toLowerCase() === 'true';
            }
          }
    
          // 处理其他可能的布尔值字段
          ['has_issues', 'has_wiki', 'auto_init'].forEach(field => {
            if (params[field] !== undefined && typeof params[field] === 'string') {
              params[field] = params[field].toLowerCase() === 'true';
            }
          });
    
          return await repoOperations.createRepository(params);
        } catch (error) {
          console.error('创建仓库失败:', error);
          throw 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 the action ('create') but doesn't describe what happens upon creation (e.g., whether it returns a repository object, error handling, or side effects). For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior beyond the basic action.

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, efficient phrase ('创建 Gitee 仓库') that is front-loaded with the core action. There is no wasted language or unnecessary elaboration, making it highly concise and structurally sound for its purpose.

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

Completeness2/5

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

Given the complexity of a 10-parameter mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain return values, error conditions, authentication requirements, or how it differs from sibling tools. For a tool that creates resources, more context is needed to guide effective use by an AI 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?

The schema description coverage is 100%, with all 10 parameters well-documented in the schema (e.g., 'auto_init' for initialization, 'private' for visibility). The description adds no additional parameter information beyond what's in the schema. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even without param details in the description.

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 '创建 Gitee 仓库' (Create Gitee repository) clearly states the verb ('create') and resource ('Gitee repository'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'fork_repository' or 'create_or_update_file', which would require more specific language about creating a new repository from scratch.

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 prerequisites (e.g., authentication needs), when to choose this over 'fork_repository', or any constraints like rate limits or permissions required. The agent must infer usage solely from the tool name and parameters.

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

Related 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/normal-coder/gitee-mcp-server'

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