Skip to main content
Glama
onemarc

GitHub Actions MCP Server

by onemarc

create_workflow

Automate GitHub repository processes by generating a new GitHub Actions workflow file. Specify triggers, jobs, and file path to streamline CI/CD pipelines.

Instructions

Create a new GitHub Actions workflow file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branchNoBranch to create the workflow onmain
commitMessageNoCommit messageAdd GitHub Actions workflow
jobsYesJobs configuration
nameYesWorkflow name - should be descriptive and related to the workflow's purpose
onYesTrigger events (e.g., {push: {branches: ['main']}, pull_request: {}})
ownerYesRepository owner
pathYesPath for the workflow file (e.g., '.github/workflows/ci.yml')
repoYesRepository name

Implementation Reference

  • The main handler function that implements the create_workflow tool. It generates YAML content for a GitHub Actions workflow based on input args and uses Octokit to create or update the file in the repository.
    const handleCreateWorkflow: ToolHandler = async (args, octokit: Octokit) => {
      const { owner, repo, path, name, on: triggerEvents, jobs, branch = "main", commitMessage = "Add GitHub Actions workflow" } = args;
      
      // Create workflow YAML content
      let modifiedTriggerEvents = { ...triggerEvents };
      if (!modifiedTriggerEvents) {
        modifiedTriggerEvents = {};
      }
      
      // Add workflow_dispatch if not already present
      if (!modifiedTriggerEvents.workflow_dispatch) {
        modifiedTriggerEvents.workflow_dispatch = {};
      }
      
      const formattedTriggerEvents = JSON.stringify(modifiedTriggerEvents, null, 2).replace(/"/g, '');
      
      const yamlContent = `name: ${name}
    
    on: ${formattedTriggerEvents}
    
    jobs:
    ${Object.entries(jobs || {}).map(([jobName, jobConfig]: [string, any]) => {
      return `  ${jobName}:
        runs-on: ${jobConfig['runs-on'] || 'ubuntu-latest'}
    ${jobConfig.steps ? '    steps:' : ''}
    ${jobConfig.steps ? jobConfig.steps.map((step: any, index: number) => {
      let stepYaml = `      - name: ${step.name || `Step ${index + 1}`}`;
      if (step.uses) stepYaml += `\n        uses: ${step.uses}`;
      if (step.run) stepYaml += `\n        run: ${step.run}`;
      if (step.with) stepYaml += `\n        with:\n${Object.entries(step.with || {}).map(([key, value]) => `          ${key}: ${value}`).join('\n')}`;
      if (step.env) stepYaml += `\n        env:\n${Object.entries(step.env || {}).map(([key, value]) => `          ${key}: ${value}`).join('\n')}`;
      return stepYaml;
    }).join('\n') : ''}`;
    }).join('\n\n')}`;
    
      try {
        const response = await octokit.rest.repos.createOrUpdateFileContents({
          owner,
          repo,
          path,
          message: commitMessage,
          content: Buffer.from(yamlContent).toString('base64'),
          branch
        });
    
        return {
          success: true,
          message: "Workflow created successfully",
          data: {
            path,
            sha: response.data.content?.sha,
            url: response.data.content?.html_url
          }
        };
      } catch (error: any) {
        throw new WorkflowError(`Failed to create workflow: ${error.message}`, error.response?.data);
      }
    };
  • The input schema and metadata definition for the create_workflow tool, specifying properties, descriptions, and required fields.
      name: "create_workflow",
      description: "Create a new GitHub Actions workflow file",
      inputSchema: {
        type: "object",
        properties: {
          owner: { type: "string", description: "Repository owner" },
          repo: { type: "string", description: "Repository name" },
          path: { type: "string", description: "Path for the workflow file (e.g., '.github/workflows/ci.yml')" },
          name: { type: "string", description: "Workflow name - should be descriptive and related to the workflow's purpose" },
          on: { type: "object", description: "Trigger events (e.g., {push: {branches: ['main']}, pull_request: {}})" },
          jobs: { type: "object", description: "Jobs configuration" },
          branch: { type: "string", description: "Branch to create the workflow on", default: "main" },
          commitMessage: { type: "string", description: "Commit message", default: "Add GitHub Actions workflow" }
        },
        required: ["owner", "repo", "path", "name", "on", "jobs"]
      }
    },
  • Registration of all tool handlers, including create_workflow mapped to its handler function.
    export const toolHandlers: Record<string, ToolHandler> = {
      create_workflow: handleCreateWorkflow,
      list_workflows: handleListWorkflows,
      get_workflow: handleGetWorkflow,
      get_workflow_usage: handleGetWorkflowUsage,
      list_workflow_runs: handleListWorkflowRuns,
      get_workflow_run: handleGetWorkflowRun,
      get_workflow_run_jobs: handleGetWorkflowRunJobs,
      trigger_workflow: handleTriggerWorkflow,
      cancel_workflow_run: handleCancelWorkflowRun,
      rerun_workflow: handleRerunWorkflow,
    };
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 'Create' which implies a write operation, but doesn't mention authentication requirements, potential side effects (e.g., committing to a branch), error conditions, or what happens on success (e.g., file creation confirmation). For a mutation tool with zero annotation coverage, this leaves critical behavioral aspects unclear.

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 that front-loads the core purpose without unnecessary words. It earns its place by clearly stating what the tool does, though it could be more informative. There's zero waste or redundancy.

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 (8 parameters, nested objects, no output schema, and no annotations), the description is incomplete. It doesn't address behavioral aspects like authentication, side effects, or error handling, nor does it provide usage context. For a creation tool with multiple required parameters and no structured safety hints, more descriptive guidance is needed.

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 8 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema (e.g., it doesn't explain how 'jobs' or 'on' should be structured). Baseline 3 is appropriate when the schema does the heavy lifting, though the description could have provided high-level context about parameter relationships.

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') and resource ('new GitHub Actions workflow file'), making the purpose immediately understandable. It distinguishes from siblings like 'get_workflow' or 'cancel_workflow_run' by focusing on creation rather than retrieval or management. However, it doesn't specify that this creates a file in a repository, which could be inferred but isn't explicit.

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., needing repository access), compare to sibling tools (e.g., 'trigger_workflow' for execution), or specify use cases (e.g., setting up CI/CD). Without annotations or context, users must infer usage from the name and parameters alone.

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/onemarc/github-actions-mcp-server'

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