devtune_create_draft_pull_request
Open a pull request on the customer's content repo, or a change request in their GitBook space, from an action's current content draft, for accounts with content pull requests, as the member who created the API key or authorized this connection; they must manage this project. The page belongs to the content source with the longest matching URL prefix (see devtune_get_content_sources), and the source's provider decides which. A refresh draft's section edits are applied to the page: each change's current text is replaced, matched after collapsing whitespace, and each new section is added after its heading. If any change does not match, nothing is written and the refusal is draft_does_not_match_source with the change numbers. A create draft becomes a new page named from the brief's target. On GitHub, DevTune commits to its own branch, devtune/action-, and opens the pull request. On GitBook, DevTune opens a change request whose description names who approved the draft, writes the page, and checks GitBook stored it as written (page_not_preserved if not). DevTune never merges either. One per action: calling again with a newer draft updates the open one. Pass draftId (the current version from devtune_get_action_draft) so a draft replaced meanwhile is refused with draft_not_latest. When no source covers the page, the refusal is no_content_source with details.sources; retry with sourceId. When the page is not found, the refusal is file_not_found with details.tried; retry with filePath (GitHub) or pagePath (GitBook). Other refusals: unavailable, no_draft, action_closed (live or archived), page_locked, source_needs_reconnect, invalid_file_path, file_exists, branch_diverged (someone else pushed to DevTune's branch; DevTune leaves their commits alone), change_request_diverged (someone else edited the change request; DevTune leaves their edits alone), change_request_conflicts (the change request has conflicts in GitBook), page_not_preserved, pull_request_in_progress, pull_request_merged, github_error and gitbook_error (details.detail is rate_limited when GitBook's rate limit for the connection is used up, recovery_incomplete when DevTune could not finish looking for a change request an earlier attempt may have opened, or recovery_stale when another attempt for the action finished while this one started; retry later). Returns the pull request: provider, state, number, url, repository and branch (GitHub) or space (GitBook), filePath (the GitBook page path for GitBook), draftId, updateFailure (a failed update beside an open change request), checkedAt (when DevTune last read a GitBook change request in GitBook; null for GitHub) and timestamps.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"actionId": "<actionId>"
},
"name": "devtune_create_draft_pull_request"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| draftId | No | The current draft version id from devtune_get_action_draft; refused if a newer draft replaced it. | |
| actionId | Yes | UUID of the action. | |
| filePath | No | The repo file to edit or create, under the source's folder, when DevTune cannot find or name it. GitHub sources only. | |
| pagePath | No | The GitBook page path to edit or create, below the space root, such as guides/quickstart, when DevTune cannot find or name it. GitBook sources only. | |
| sourceId | No | A content source id from devtune_get_content_sources, for a page no source covers. |