Loading
Add get_duo_session mcp tool
What does this MR do and why?
Adds the EE get_duo_session MCP tool, with the legacy get_duo_workflow_status alias, so MCP clients can retrieve a Duo Agent platform session by numeric workflow ID.
References
closes #607634 (closed)
Screenshots or screen recordings
N/A
How to set up and validate locally
- Create an OAuth token that can access the MCP server, then set the endpoint, token, and a numeric workflow ID visible to that user:
- Check that get_duo_session is registered
curl --silent --request POST "$MCP_URL" \
--header "Authorization: Bearer $MCP_OAUTH_TOKEN" \
--header 'Content-Type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' |
jq -er '.result.tools[] | select(.name == "get_duo_session") | .name'- Retrieve the Duo session
curl --silent --request POST "$MCP_URL" \
--header "Authorization: Bearer $MCP_OAUTH_TOKEN" \
--header 'Content-Type: application/json' \
--data "$(jq -cn --argjson workflow_id "$WORKFLOW_ID" \
'{jsonrpc:"2.0",id:2,method:"tools/call",
params:{name:"get_duo_session",arguments:{workflow_id:$workflow_id}}}')" |
jq- Validate the response shape
curl --silent --request POST "$MCP_URL" \
--header "Authorization: Bearer $MCP_OAUTH_TOKEN" \
--header 'Content-Type: application/json' \
--data "$(jq -cn --argjson workflow_id "$WORKFLOW_ID" \
'{jsonrpc:"2.0",id:3,method:"tools/call",
params:{name:"get_duo_session",arguments:{workflow_id:$workflow_id}}}')" |
jq -e --argjson workflow_id "$WORKFLOW_ID" '
.result.isError == false and
(.result.structuredContent.workflow_id == $workflow_id) and
(.result.structuredContent.status | type == "string") and
(.result.structuredContent.web_url | type == "string") and
((.result.structuredContent.poll_after_seconds? == null) or
(.result.structuredContent.poll_after_seconds | type == "number")) and
((.result.structuredContent.awaiting_approval? == null) or
(.result.structuredContent.awaiting_approval | type == "boolean")) and
((.result.structuredContent.turn_complete? == null) or
(.result.structuredContent.turn_complete | type == "boolean"))
'- Run the focused specs
bundle exec rspec \
ee/spec/services/mcp/tools/duo_workflows/get_duo_session_tool_spec.rb \
ee/spec/services/mcp/tools/duo_workflows/get_duo_session_service_spec.rb \
ee/spec/services/ai/duo_workflows/mcp_config_service_spec.rb \
ee/spec/requests/api/mcp/handlers/list_tools_spec.rbMR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #607634 (closed)
Edited by Alex Filatov