Skip to main content
Glama
Sunwood-ai-labs

GitHub Kanban MCP Server

create_issue

Create GitHub issues with titles, emojis, labels, assignees, and formatted bodies to enhance task management and readability on a Kanban board.

Instructions

新しいissueを作成します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assigneesNoアサインするユーザー
bodyNoissueの本文(## の先頭には絵文字を付与して可読性を上げて)
emojiNoタイトルの先頭に付与するユニークな絵文字
labelsNoissueのラベル
pathNoGitリポジトリの絶対パス
titleYesissueのタイトル

Implementation Reference

  • Main handler function that executes the create_issue tool logic: validates args, ensures labels exist, creates temp file for body if needed, runs `gh issue create`, fetches issue details, returns response.
    export async function handleCreateIssue(args: CreateIssueArgs): Promise<ToolResponse> {
      const { owner, repo } = await getRepoInfo(args);
      const assigneesFlag = args.assignees?.length ? `--assignee ${args.assignees.join(',')}` : '';
      const tempFile = 'issue_body.md';
      let bodyFlag = '';
    
      try {
        // ラベルの存在確認と作成
        if (args.labels?.length) {
          const existingLabels = await getExistingLabels(args.path);
          for (const label of args.labels) {
            if (!existingLabels.includes(label)) {
              await createLabel(args.path, label);
            }
          }
        }
        const labelsFlag = args.labels?.length ? `--label ${args.labels.join(',')}` : '';
    
        if (args.body) {
          const fullPath = await writeToTempFile(args.body, tempFile);
          bodyFlag = `--body-file "${fullPath}"`;
        }
    
        // タイトルに絵文字を付与(指定がある場合)
        const titleWithEmoji = args.emoji ? `${args.emoji} ${args.title}` : args.title;
    
        const { stdout } = await execAsync(
          `gh issue create --repo ${owner}/${repo} --title "${titleWithEmoji}" ${bodyFlag} ${labelsFlag} ${assigneesFlag}`
        );
    
        // URLから issue number を抽出
        const issueUrl = stdout.trim();
        const issueNumber = issueUrl.split('/').pop();
    
        // 作成したissueの詳細情報を取得
        const { stdout: issueData } = await execAsync(
          `gh issue view ${issueNumber} --repo ${owner}/${repo} --json number,title,url`
        );
    
        return {
          content: [
            {
              type: 'text',
              text: issueData,
            },
          ],
        };
      } finally {
        if (args.body) {
          await removeTempFile(tempFile);
        }
      }
    }
  • JSON schema defining the input parameters for the create_issue tool, including path, title (required), emoji, body, labels, assignees.
    export const createIssueSchema = {
      type: 'object',
      properties: {
        path: {
          type: 'string',
          description: 'Gitリポジトリの絶対パス',
        },
        title: {
          type: 'string',
          description: 'issueのタイトル',
        },
        emoji: {
          type: 'string',
          description: 'タイトルの先頭に付与するユニークな絵文字',
        },
        body: {
          type: 'string',
          description: 'issueの本文(## の先頭には絵文字を付与して可読性を上げて)',
        },
        labels: {
          type: 'array',
          items: {
            type: 'string',
          },
          description: 'issueのラベル',
        },
        assignees: {
          type: 'array',
          items: {
            type: 'string',
          },
          description: 'アサインするユーザー',
        }
      },
      required: ['title'],
    };
  • src/server.ts:47-50 (registration)
    Registration of the create_issue tool in the MCP server's listTools response, specifying name, description, and inputSchema.
      name: 'create_issue',
      description: '新しいissueを作成します',
      inputSchema: createIssueSchema,
    },
  • Dispatch handler in the main tool request switch statement that validates title and calls the specific handleCreateIssue function.
    case 'create_issue': {
      if (!args?.title) {
        throw new McpError(ErrorCode.InvalidParams, 'Title is required');
      }
      return await handleCreateIssue({
        path: args.path as string,
        title: args.title as string,
        emoji: args?.emoji as string | undefined,
        body: args?.body as string | undefined,
        labels: args?.labels as string[] | undefined,
        assignees: args?.assignees as string[] | undefined,
      });
    }
  • TypeScript interface defining the arguments for create_issue handler.
    export interface CreateIssueArgs {
      path: string;  // Gitリポジトリの絶対パス
      title: string;
      emoji?: string;
      body?: string;
      labels?: string[];
      assignees?: string[];
    }
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/Sunwood-ai-labs/github-kanban-mcp-server'

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