Skip to main content
Glama

Create a GitHub pull request

github_pr_create

Creates a pull request from a pushed branch, setting title, body, draft status, labels, assignees, reviewers, milestone, closing issues, and project board fields in one validated call.

Instructions

Open a pull request from a pushed branch of a repository the viewer may write to into another branch of it (default: the default branch), and settle its place in the same call: draft, labels, assignees and reviewers (they are notified), milestone, the issues it closes (a Closes #12 line at the end of the body) and a project board with field values (the Status starts as Todo). Pull requests from forks are not supported yet. Everything that can fail is checked before the pull request is made: the branches exist, head_sha (when given) is still the head, no pull request is open from head into base already, the milestone exists and the board accepts the values. A pull request that was made is always returned, even when GitHub reported a failure while making it or a later step fails (labels, assignees, reviewers and milestone are applied right after it is made; then the read-back, board and field steps): what failed after it is listed in errors, keyed by step (create, attachments, metadata, read, head_sha, project, fields.). GitHub links closing issues only for a pull request into the default branch, and a moment after it exists: the call waits up to a few seconds for the link, and notes say when this pull request is not into the default branch or an issue was not linked yet. A pull request is 12, #12, owner/repo#12 or its URL; a bare number in closes means the pull request's repository. A board is named by project: its number, owner/number or its URL, used as it is; any other project is a title, and no project is Roadmap: the open board of that whole title is looked up, never guessed, in owner's boards if owner is given, else in the boards linked to repo, then its organization's, then the viewer's. Field values are set by field name and option or iteration name, matched without regard to case: text as a string, number as a number or numeric string, date as YYYY-MM-DD, single select as an option name, iteration as an iteration title or @current (the iteration containing today, UTC). Only text, number, date, single select and iteration fields can be set; a column that mirrors an issue field is set with the issue tools' issue_fields, not here. GitHub's own (Title, Assignees, Labels, Milestone, Repository, Linked pull requests, …) are set on the issue, and github_issue_edit sets assignees, labels and milestone. Every field and value is checked before anything is written. Needs a token with the project scope; if GitHub reports missing scopes, run gh auth refresh -s project. Attachments are images (png, jpg, gif, webp, svg, up to 10 MiB) and videos (mp4, mov, webm, up to 100 MiB), up to 50, uploaded with the text: a body reference like ![alt](./shot.png) becomes the uploaded file and the others are appended; they need gh 2.99 or newer, and a file that fails to upload is listed under errors.attachments while the rest goes through.

Input Schema

NameRequiredDescriptionDefault
baseNoThe branch of the repository to merge into; defaults to its default branch.
bodyNoMarkdown body; empty when left out.
headYesThe branch of the repository to merge from; it must be pushed already.
repoNoowner/name; defaults to the working tree's repository (its origin).
draftNoOpen it as a draft (default false).
titleYesThe pull request's title.
closesNoIssues this pull request closes when it merges, as 12, #12, owner/repo#12 or an issue URL (a bare number means the pull request's repository): a `Closes #12` line is added to the end of the body. GitHub links them only for a pull request into the default branch.
fieldsNoBoard field values to set, by field name: {"Target": "2026-12-01"}; needs project. A Status given here replaces the Todo default.
labelsNoLabels to add; they must exist.
projectNoA board to put the pull request on: its number, owner/number or its URL, or its title; none by default. The pull request starts as Todo on the board when it has that Status option.
head_shaNoThe commit the head branch must be at (40 hex characters): the call fails with stale, creating nothing, when the branch moved.
assigneesNoLogins, or "@me".
milestoneNoA milestone title; it must exist.
reviewersNoLogins, or org/team, to request a review from; they are notified.
attachmentsNoImages and videos to upload with the text.

Output Schema

NameRequiredDescriptionDefault
prYes
baseYes
headYes
repoYes
draftYes
notesYesWhat to know about the result; [] when nothing.
errorsYesFailed steps, keyed by step (fields.<Field name>, blocked_by, kind, labels, milestone); {} when none.
foreignYes
projectYesThe board item; null when no project was given or its step failed.
head_shaYesThe commit the head branch is at, as read after the pull request was created.
attachmentsYesThe files that were sent; [] when none were given.
closing_issuesYesThe issues GitHub links as closed by the pull request; [] when none or when it could not be read.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.7.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only declare the safety/idempotency profile; the description adds substantial behavior beyond them: exhaustive pre-flight checks before creation, guaranteed return even on later failures with an errors map keyed by step (create, attachments, metadata, read, head_sha, project, fields.<Name>), the wait for GitHub's closing-issue link, fork unsupported, and gh 2.99 requirement for attachments. This is far more than the annotations provide and directly affects how an agent should parse results.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded well in the first clause, and nearly every sentence carries operational detail. However, it is delivered as a single dense run-on block covering creation, failure handling, issue linking, board resolution, field typing, auth, and attachments with no grouping, which makes it hard for an agent to locate the relevant rule.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 15-parameter, nested-object mutation tool, the description covers failure semantics, auth scoping, precondition checks, defaulting rules, and attachment constraints; an output schema exists so return-shape explanation is rightly omitted. Nothing an agent needs to invoke this correctly appears to be missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real semantics not in the schema: project resolution order (owner boards, then repo-linked, then org, then viewer; never guessed), case-insensitive field matching, date format YYYY-MM-DD, iteration @current as the UTC iteration containing today, and which field types are settable. That goes meaningfully beyond the schema's terse field descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Open a pull request from a pushed branch... into another branch') and immediately enumerates scope (draft, labels, assignees, reviewers, milestone, closes, project board). Combined with the sibling list (github_pr_read, github_pr_edit, github_pr_merge, etc.), an agent can tell this is the create operation without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit context for when to use this versus alternatives: 'a column that mirrors an issue field is set with the issue tools' issue_fields, not here' and 'GitHub's own (...) are set on the issue, and github_issue_edit sets assignees, labels and milestone'. It also names the prerequisite (token with project scope, gh auth refresh -s project) and the fork exclusion. The routing to siblings is slightly muddled across references, keeping it below a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.