Skip to main content
Glama
ddukbg

GitHub Enterprise MCP Server

trigger-workflow

Initiate GitHub workflow executions by specifying repository details, workflow ID, Git reference, and inputs. Integrates with GitHub Enterprise API for streamlined process automation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputsNoWorkflow inputs
ownerYesRepository owner
refYesGit reference (branch, tag, SHA)
repoYesRepository name
workflow_idYesWorkflow ID or file name

Implementation Reference

  • Registration of the MCP tool 'trigger-workflow', including Zod input schema (owner, repo, workflow_id, ref, inputs) and handler function that performs parameter validation and calls ActionsAPI.dispatchWorkflow
    server.tool( "trigger-workflow", { owner: z.string().min(1).describe("Repository owner"), repo: z.string().min(1).describe("Repository name"), workflow_id: z.union([z.string(), z.number()]).describe("Workflow ID or file name"), ref: z.string().min(1).describe("Git reference (branch, tag, SHA)"), inputs: z.record(z.string()).optional().describe("Workflow inputs") }, async ({ owner, repo, workflow_id, ref, inputs }) => { try { // Parameter validation if (!owner || typeof owner !== 'string' || owner.trim() === '') { return { content: [ { type: "text", text: "Repository owner is required." } ] }; } if (!repo || typeof repo !== 'string' || repo.trim() === '') { return { content: [ { type: "text", text: "Repository name is required." } ] }; } if (!workflow_id) { return { content: [ { type: "text", text: "Workflow ID or filename is required." } ] }; } if (!ref || typeof ref !== 'string' || ref.trim() === '') { return { content: [ { type: "text", text: "Git reference (branch, tag, or SHA) is required." } ] }; } await context.actions.dispatchWorkflow(owner, repo, workflow_id, { ref, inputs }); return { content: [ { type: "text", text: `Successfully triggered workflow '${workflow_id}' in repository '${owner}/${repo}' on ref '${ref}'.` } ] }; } catch (error: any) { return { content: [ { type: "text", text: `Error triggering workflow: ${error.message}` } ] }; } } );
  • Core handler function that executes the GitHub API POST request to trigger a workflow_dispatch event
    async dispatchWorkflow(owner: string, repo: string, workflowId: number | string, options: WorkflowDispatchOptions): Promise<void> { await this.client.post(`repos/${owner}/${repo}/actions/workflows/${workflowId}/dispatches`, options); }
  • TypeScript interface defining the options structure for dispatching a workflow (ref and optional inputs)
    export interface WorkflowDispatchOptions { ref: string; // The git reference for the workflow (branch, tag, HEAD) inputs?: Record<string, string>; // Input parameters defined in the workflow file }
  • Zod validation schema for the 'trigger-workflow' tool inputs
    { owner: z.string().min(1).describe("Repository owner"), repo: z.string().min(1).describe("Repository name"), workflow_id: z.union([z.string(), z.number()]).describe("Workflow ID or file name"), ref: z.string().min(1).describe("Git reference (branch, tag, SHA)"), inputs: z.record(z.string()).optional().describe("Workflow inputs") },
  • Creation and inclusion of ActionsAPI instance in the MCP server context, enabling access to workflow actions from tool handlers
    const actions = new ActionsAPI(client); const pulls = PullsAPI; const issues = IssuesAPI; // Create context const context: GitHubContext = { client, repository, admin, actions, pulls,

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/ddukbg/github-enterprise-mcp'

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