Skip to main content
Glama
kunwarVivek

mcp-github-project-manager

create_automation_rule

Create automation rules for GitHub projects to trigger actions based on events like issue changes, PR updates, or scheduled tasks.

Instructions

Create a new automation rule for a GitHub project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
descriptionNo
projectIdYes
enabledYes
triggersYes
actionsYes

Implementation Reference

  • Core handler implementing the GitHub GraphQL mutation to create ProjectV2 automation rules
    async create(data: CreateAutomationRule): Promise<AutomationRule> {
      const mutation = `
        mutation($input: CreateProjectV2RuleInput!) {
          createProjectV2Rule(input: $input) {
            projectRule {
              id
              databaseId
              createdAt
              updatedAt
              isActive
              name
              ruleTrigger {
                type
                whenStateEquals
                whenStateWas
                whenFieldValueEquals
                whenFieldId
              }
              ruleActions {
                type
                fieldId
                value
                projectItemId
                sourceFieldId
                targetFieldId
                labelName
                milestoneId
              }
            }
          }
        }
      `;
    
      try {
        const variables = this.prepareCreateRuleVariables(data);
        const response = await this.graphql<CreateProjectRuleResponse>(mutation, variables);
        return this.mapGitHubRuleToAutomationRule(response.createProjectV2Rule.projectRule, data.projectId);
      } catch (error) {
        this.logger.error(`Failed to create automation rule for project ${data.projectId}`, error);
        throw this.handleGraphQLError(error);
      }
    }
  • Service layer handler that validates input, checks project existence, and delegates to repository
    async createAutomationRule(data: {
      name: string;
      description?: string;
      projectId: string;
      enabled?: boolean;
      triggers: Array<{
        type: string;
        resourceType?: string;
        conditions?: Array<{
          field: string;
          operator: string;
          value: any;
        }>;
      }>;
      actions: Array<{
        type: string;
        parameters: Record<string, any>;
      }>;
    }): Promise<{
      id: string;
      name: string;
      description?: string;
      projectId: string;
      enabled: boolean;
      triggers: any[];
      actions: any[];
    }> {
      try {
        // Verify project exists
        const project = await this.projectRepo.findById(data.projectId);
        if (!project) {
          throw new ResourceNotFoundError(ResourceType.PROJECT, data.projectId);
        }
    
        const rule = await this.automationRepo.create({
          name: data.name,
          description: data.description,
          projectId: data.projectId,
          enabled: data.enabled ?? true,
          triggers: data.triggers as any,
          actions: data.actions as any
        });
    
        return {
          id: rule.id,
          name: rule.name,
          description: rule.description,
          projectId: rule.projectId,
          enabled: rule.enabled,
          triggers: rule.triggers,
          actions: rule.actions
        };
      } catch (error) {
        throw this.mapErrorToMCPError(error);
      }
  • MCP tool definition including name, description, input schema, and examples
    export const createAutomationRuleTool: ToolDefinition<CreateAutomationRuleArgs> = {
      name: "create_automation_rule",
      description: "Create a new automation rule for a GitHub project",
      schema: createAutomationRuleSchema as unknown as ToolSchema<CreateAutomationRuleArgs>,
      examples: [
        {
          name: "Auto-label PRs",
          description: "Automatically add 'needs-review' label when PR is opened",
          args: {
            name: "Auto-label new PRs",
            projectId: "PVT_kwDOLhQ7gc4AOEbH",
            enabled: true,
            triggers: [{
              type: "pr_opened"
            }],
            actions: [{
              type: "add_label",
              parameters: { labelName: "needs-review" }
            }]
          }
        },
        {
          name: "Auto-assign issues",
          description: "Automatically assign issues with 'bug' label to maintainer",
          args: {
            name: "Auto-assign bugs",
            projectId: "PVT_kwDOLhQ7gc4AOEbH",
            enabled: true,
            triggers: [{
              type: "issue_labeled",
              conditions: [{
                field: "label",
                operator: "equals",
                value: "bug"
              }]
            }],
            actions: [{
              type: "assign_user",
              parameters: { username: "maintainer" }
            }]
          }
        }
      ]
    };
  • Registers the create_automation_rule tool in the central ToolRegistry singleton
    this.registerTool(createAutomationRuleTool);
    this.registerTool(updateAutomationRuleTool);
    this.registerTool(deleteAutomationRuleTool);
    this.registerTool(getAutomationRuleTool);
    this.registerTool(listAutomationRulesTool);
    this.registerTool(enableAutomationRuleTool);
    this.registerTool(disableAutomationRuleTool);
  • Domain type definition for CreateAutomationRule input structure used across services and repository
    export interface CreateAutomationRule {
      name: string;
      description?: string;
      projectId: string;
      enabled?: boolean;
      triggers: Omit<AutomationTrigger, "id">[];
      actions: Omit<AutomationAction, "id">[];
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the action ('create') without details on permissions, side effects, error handling, or response format. It misses critical information like whether this requires admin access, what happens on failure, or if it's idempotent.

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 sentence with no wasted words, making it easy to parse. It's appropriately sized for a basic purpose statement, though it lacks depth due to its brevity.

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 (6 parameters with nested structures, no annotations, no output schema), the description is insufficient. It doesn't explain parameter meanings, behavioral traits, or expected outcomes, making it incomplete for effective tool use in this context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter details. The description adds no information about the 6 parameters (e.g., what 'triggers' or 'actions' entail, format of 'projectId'), failing to compensate for the coverage gap and leaving parameters largely unexplained.

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 verb ('create') and resource ('automation rule for a GitHub project'), making the purpose evident. However, it doesn't differentiate from sibling tools like 'update_automation_rule' or 'delete_automation_rule', which would require explicit scope or condition distinctions.

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 such as 'update_automation_rule' or 'list_automation_rules'. The description lacks context about prerequisites, typical scenarios, or exclusions, leaving usage ambiguous.

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/kunwarVivek/mcp-github-project-manager'

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