LaunchDarkly Approval Requests
You're using a skill that takes a change through LaunchDarkly approvals: request it, hand the review to a person, check the outcome when asked, and apply it once it is approved. A person approves or declines every request in LaunchDarkly. You never do either.
Prerequisites
This skill requires the remotely hosted LaunchDarkly MCP server.
| Resource | Request | Check | Apply |
|---|---|---|---|
| Flag or segment | create-approval-request |
get-approval-requests |
apply-approval-request |
| AgentControl Config | create-agent-config-approval |
get-agent-config-approvals |
apply-agent-config-approval |
get-approval-requests with only id returns any request, including one for an AgentControl Config, so you never need to ask which kind of request an id belongs to.
Core Principles
- A person decides. Approving and declining happen in LaunchDarkly, by a reviewer. Never approve, never decline, and never look for another way to make a blocked change.
- Reviewers come from the user. Pass only reviewers the user named, in
notifyMemberIdsandnotifyTeamKeys. Never pick one yourself. If the tool rejects the reviewers, ask the user who should review, then call it again. - Hand off, then wait. After you create a request, the next step is the user's. Do not poll for the outcome.
- Apply only what is approved. Apply a request only when its
reviewStatusisapproved, and only when the user asks for it.
Workflow
1. Request the change
Usually a write tool reports that the environment requires approval and returns the instructions it tried. Create the request with those same instructions and a description of what the change does.
- Reviewers. The create tool checks whether the environment requires a reviewer. A flag needs one when its environment requires approval for flag changes. A segment always needs one. If the user named no reviewer and the tool says one is required, ask the user who should review.
- Approval integrations. When an integration such as ServiceNow runs the review, it takes no LaunchDarkly reviewers. Pass its form fields in
integrationConfiginstead. - Self-review. When requesters cannot review their own requests, the user cannot be a reviewer on their request.
- AgentControl Configs. Without
env, the request covers every environment, and LaunchDarkly applies the project's strictest approval settings.
2. Hand the review to the user
The create result includes approvalRequest.url. Open it in the user's browser when your client can, for example with open, xdg-open, or a browser tool. Show the link in your reply either way. Tell the user who was asked to review, and that you will check the outcome when they tell you the request has been reviewed.
Stop there. Do not call the check tool in a loop while you wait.
3. Check the outcome when the user asks
Call the check tool once, with the request's id. The id from the create result is enough on its own, and any key you pass with it must match the request's resource.
Each request has two states. Report both:
| Field | Meaning | Values |
|---|---|---|
reviewStatus |
the reviewers' decision | pending, approved, declined |
status |
the change itself | pending, scheduled, completed (applied), failed |
Each request lists its reviews with kind, comment, creationDate, and the memberId or serviceTokenId that left it. When a request is declined, give the reviewer and their reason.
For an integration-managed approval with auto-apply on, LaunchDarkly can apply the request itself once it is approved, so the one read can already show status as scheduled or completed. Do not read again to find out, and do not apply a request that is no longer pending.
4. Apply an approved request
When the user asks you to apply a request:
reviewStatusisapprovedandstatusispending: apply it withconfirm: trueand an optional comment. The flag and segment tool takesprojectKeyandid. The AgentControl Config tool takes onlyid.reviewStatusispendingordeclined: do not apply it. Tell the user where it stands.statusis alreadycompletedorscheduled: nothing is left to apply. Say so.statusisfailed: the change did not go live. Tell the user the apply failed and give the request'sdescription. Do not apply it again unless the user asks.
An applied request with scheduled: true is not live until its executionDate. Say when it takes effect.
The apply tool reads the request back and returns applied. Report the change as live only when applied is true and you have read the resource back (get-flags, get-segments, or get-agent-configs) to confirm it.
When applied is false and there is no scheduled: true, the change is not confirmed. Say that, repeat the message, and do not call the apply tool again. Two cases return it: LaunchDarkly accepted the apply but the read-back failed, or the read-back shows a status other than completed. Call the check tool once and report the status, then leave the next step to the user.
Finding requests
- One flag or segment:
get-approval-requestswithprojectKey,env, andflagKeyorsegmentKey(never both). - Waiting on the user: call
get-member-self, thenget-approval-requestswithprojectKey,assignedToMemberIdsset to that id, andreviewStatus: ["pending"]. That filter finds only requests sent to the user by member id, so also list the project's pending requests withoutassignedToMemberIdsand add each one whosenotifyTeamKeysholds a team key fromget-member-self'steams. Both lists are paged (20 by default, up to 200): whilenextOffsetis set, call again with it asoffset, and read every page before you report the list as complete, because a team request on a later page is otherwise missed. Combine the two lists without repeating a requestid, and say that the result includes requests sent to the user's teams. - The whole project:
get-approval-requestswith onlyprojectKeylists what the project's Approvals page shows, across flags, segments, and AgentControl Configs, newest first. Narrow it byenv,requestedByMemberId,resourceKind,status, orreviewStatus. The list is paged (20 by default, up to 200). WhilenextOffsetis set, call again with it asoffset. Read every page before you report the list as complete. - One AgentControl Config:
get-agent-config-approvalswithprojectKeyandconfigKey.
Timestamps in results are UTC.
What not to do
- Do not approve or decline a request, or ask the user for permission to do so.
- Do not retry a blocked write in the hope that it goes through.
- Do not choose reviewers the user did not name.
- Do not check the outcome repeatedly while waiting for a reviewer.