Skip to main content
Glama

同步项目看板

gitea_workflow_sync_board

Sync Gitea project boards with workflow status columns by mapping issue labels to board columns like Backlog, In Progress, Review, Testing, and Done.

Instructions

Create or update project board with columns mapped to status labels. Columns: Backlog, In Progress, Review, Testing, Done.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerNoRepository owner. Uses context if not provided
repoNoRepository name. Uses context if not provided
board_nameNoProject board name (default: from config)

Implementation Reference

  • Core implementation of the gitea_workflow_sync_board tool. Loads workflow config, creates project board if missing, syncs columns based on config.board.columns.
    export async function workflowSyncBoard(
      ctx: WorkflowToolsContext,
      args: {
        owner?: string;
        repo?: string;
        config?: WorkflowConfig;
        board_name?: string;
      }
    ): Promise<{
      success: boolean;
      project_id?: number;
      project_name?: string;
      columns_created: string[];
      columns_existing: string[];
      error?: string;
    }> {
      logger.debug({ args: { ...args, config: args.config ? '[provided]' : undefined } }, 'Syncing board');
    
      const { owner, repo } = ctx.contextManager.resolveOwnerRepo(args.owner, args.repo);
    
      // 获取配置
      let config = args.config;
      if (!config) {
        const loadResult = await workflowLoadConfig(ctx, { owner, repo });
        if (!loadResult.success || !loadResult.config) {
          return {
            success: false,
            columns_created: [],
            columns_existing: [],
            error: loadResult.error || '无法加载配置',
          };
        }
        config = loadResult.config;
      }
    
      const boardName = args.board_name || config.board.name;
      const columnsCreated: string[] = [];
      const columnsExisting: string[] = [];
    
      try {
        // 获取现有项目
        const projects = await ctx.client.get<Array<{ id: number; title: string }>>(
          `/repos/${owner}/${repo}/projects`
        );
    
        let project = projects.find((p) => p.title === boardName);
    
        // 创建项目(如果不存在)
        if (!project) {
          project = await ctx.client.post<{ id: number; title: string }>(
            `/repos/${owner}/${repo}/projects`,
            {
              title: boardName,
            }
          );
          logger.info({ owner, repo, project_id: project.id }, 'Project created');
        }
    
        // 获取现有列
        const existingColumns = await ctx.client.get<Array<{ id: number; title: string }>>(
          `/projects/${project.id}/columns`
        );
        const existingColumnNames = new Set(existingColumns.map((c) => c.title));
    
        // 创建缺失的列
        for (const column of config.board.columns) {
          if (existingColumnNames.has(column.name)) {
            columnsExisting.push(column.name);
          } else {
            await ctx.client.post(`/projects/${project.id}/columns`, {
              title: column.name,
            });
            columnsCreated.push(column.name);
          }
        }
    
        logger.info(
          { owner, repo, project_id: project.id, created: columnsCreated.length },
          'Board synced'
        );
    
        return {
          success: true,
          project_id: project.id,
          project_name: boardName,
          columns_created: columnsCreated,
          columns_existing: columnsExisting,
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        logger.error({ owner, repo, error: errorMessage }, 'Failed to sync board');
    
        return {
          success: false,
          columns_created: columnsCreated,
          columns_existing: columnsExisting,
          error: errorMessage,
        };
      }
    }
  • Registers the gitea_workflow_sync_board tool with the MCP server, including input schema and wrapper handler that delegates to workflowSyncBoard.
    mcpServer.registerTool(
      'gitea_workflow_sync_board',
      {
        title: '同步项目看板',
        description:
          'Create or update project board with columns mapped to status labels. Columns: Backlog, In Progress, Review, Testing, Done.',
        inputSchema: z.object({
          owner: z.string().optional().describe('Repository owner. Uses context if not provided'),
          repo: z.string().optional().describe('Repository name. Uses context if not provided'),
          board_name: z.string().optional().describe('Project board name (default: from config)'),
        }),
      },
      async (args) => {
        try {
          const result = await WorkflowTools.workflowSyncBoard(
            { client: ctx.client, contextManager: ctx.contextManager },
            args
          );
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
            isError: !result.success,
          };
        } catch (error: unknown) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          return {
            content: [{ type: 'text' as const, text: `Error: ${errorMessage}` }],
            isError: true,
          };
        }
      }
    );
  • Zod input schema definition for the tool parameters.
      inputSchema: z.object({
        owner: z.string().optional().describe('Repository owner. Uses context if not provided'),
        repo: z.string().optional().describe('Repository name. Uses context if not provided'),
        board_name: z.string().optional().describe('Project board name (default: from config)'),
      }),
    },
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral insight. It mentions 'Create or update' implying mutation but doesn't disclose permissions needed, whether it's idempotent, what happens on conflicts, or rate limits. The column mapping is described but without details on how labels are mapped or if defaults apply.

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 front-loaded with the core purpose and efficiently lists columns in one sentence. However, the column list could be integrated more smoothly, and it lacks structural elements like prerequisites or examples.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'mapped to status labels' entails operationally, what the tool returns, error conditions, or how it interacts with other workflow tools, leaving significant gaps 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%, so the schema already documents all three parameters. The description adds no parameter-specific information beyond implying board configuration, which doesn't compensate for schema details. Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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 ('Create or update project board') and specifies what it does ('with columns mapped to status labels'), distinguishing it from sibling tools like gitea_workflow_sync_labels or gitea_workflow_init. However, it doesn't explicitly differentiate from all siblings (e.g., gitea_workflow_generate_report) in terms of resource focus.

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. The description lists columns but doesn't specify prerequisites, timing, or context for choosing this over other workflow tools like gitea_workflow_init or gitea_workflow_sync_labels.

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/SupenBysz/gitea-mcp-tool'

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