Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
mcp-server-jira
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-solutions
mcp-server-jira
Commits
ab3ee6a4
Commit
ab3ee6a4
authored
Mar 11, 2026
by
MD. SHAHIDUL ISLAM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add mark_done_and_assign_to_qa tool and corresponding tests
parent
e6fb2c6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
165 additions
and
0 deletions
+165
-0
server.py
jira_mcp/server.py
+81
-0
test_mark_done_and_qa.py
test_mark_done_and_qa.py
+84
-0
No files found.
jira_mcp/server.py
View file @
ab3ee6a4
...
...
@@ -423,6 +423,87 @@ def transition_issue(issue_key: str, transition_name: str) -> str:
except
Exception
as
e
:
return
f
"Error transitioning issue {issue_key}: {str(e)}"
@mcp.tool
()
def
mark_done_and_assign_to_qa
(
issue_key
:
str
,
qa_tester
:
str
=
None
)
->
str
:
"""
Marks an issue as complete and assigns it to the QA tester in one operation.
This tool performs two actions:
1. Transitions the issue to 'QA Assigned' status (from completed development)
2. Assigns the issue to the QA tester
Args:
issue_key: The Jira issue key (e.g., 'PCM-227')
qa_tester: The QA tester's username. If not provided, uses JIRA_QA_TESTER env variable.
If neither available, raises an error with instructions.
Returns: Success message with both operations completed, or error if unable to proceed.
IMPORTANT: You must explicitly ask the user for confirmation before executing this tool.
"""
jira
=
_get_jira
()
# Determine which tester to use
tester_username
=
qa_tester
or
JIRA_QA_TESTER
if
not
tester_username
:
return
(
"Error: QA tester not specified. Please provide the tester's username.
\n
"
f
"Set the environment variable JIRA_QA_TESTER or call this tool with qa_tester parameter.
\n
"
f
"Example: mark_done_and_assign_to_qa('{issue_key}', 'samia')
\n\n
"
"Configured users:
\n
"
"- Shahidul Islam
\n
"
"- Samia Islam
\n
"
"- Md. Sazzadul Islam
\n
"
"- Ruhit Arman
\n
"
"- Sudipta Anupan Datta
\n
"
"- Mehreen Rashid
\n
"
"- Asif Anam
\n
"
"- Ayasha Hossain Jui"
)
try
:
# Step 1: Transition issue to "QA Assigned" (which maps to "Ready for QA")
transitions
=
jira
.
transitions
(
issue_key
)
transition_id
=
None
available_transitions
=
[]
for
t
in
transitions
:
available_transitions
.
append
(
t
[
'name'
])
# Look for "Ready for QA" transition (normalized from "QA Assigned")
if
t
[
'name'
]
.
lower
()
==
"ready for qa"
:
transition_id
=
t
[
'id'
]
break
if
not
transition_id
:
available_str
=
", "
.
join
(
f
"'{name}'"
for
name
in
available_transitions
)
return
(
f
"Error: Cannot transition issue {issue_key} to 'QA Assigned'.
\n
"
f
"Available transitions: {available_str}
\n
"
f
"The issue may not be in a state that allows QA assignment."
)
# Execute transition
jira
.
transition_issue
(
issue_key
,
transition_id
)
# Step 2: Assign to QA tester
jira
.
assign_issue
(
issue_key
,
tester_username
)
# Get updated issue details for confirmation
issue
=
jira
.
issue
(
issue_key
)
status
=
issue
.
fields
.
status
.
name
assignee
=
issue
.
fields
.
assignee
.
displayName
if
issue
.
fields
.
assignee
else
"Unassigned"
return
(
f
"✅ Successfully completed both operations for [{issue_key}]({BASE_URL}/browse/{issue_key}):
\n
"
f
" • Status transitioned to: {status}
\n
"
f
" • Assigned to: {assignee}
\n
"
f
" • Summary: {issue.fields.summary}"
)
except
Exception
as
e
:
return
f
"Error marking issue {issue_key} done and assigning to QA: {str(e)}"
@mcp.tool
()
def
search_issues
(
jql_query
:
str
)
->
str
:
"""Searches Jira for issues using a JQL (Jira Query Language) string.
...
...
test_mark_done_and_qa.py
0 → 100644
View file @
ab3ee6a4
#!/usr/bin/env python3
"""Test the mark_done_and_assign_to_qa tool logic."""
# Simulated environment
JIRA_QA_TESTER
=
"samia"
# Set or None to test both scenarios
BASE_URL
=
"http://103.41.111.60:8085"
def
mark_done_and_assign_to_qa_test
(
issue_key
:
str
,
qa_tester
:
str
=
None
)
->
str
:
"""Simulated version of the mark_done_and_assign_to_qa tool for testing."""
# Determine which tester to use
tester_username
=
qa_tester
or
JIRA_QA_TESTER
if
not
tester_username
:
return
(
"Error: QA tester not specified. Please provide the tester's username.
\n
"
f
"Set the environment variable JIRA_QA_TESTER or call this tool with qa_tester parameter.
\n
"
f
"Example: mark_done_and_assign_to_qa('{issue_key}', 'samia')
\n\n
"
"Configured users:
\n
"
"- Shahidul Islam
\n
"
"- Samia Islam
\n
"
"- Md. Sazzadul Islam
\n
"
"- Ruhit Arman
\n
"
"- Sudipta Anupan Datta
\n
"
"- Mehreen Rashid
\n
"
"- Asif Anam
\n
"
"- Ayasha Hossain Jui"
)
# Simulate successful operation
return
(
f
"✅ Successfully completed both operations for [{issue_key}]({BASE_URL}/browse/{issue_key}):
\n
"
f
" • Status transitioned to: QA Assigned
\n
"
f
" • Assigned to: {tester_username}
\n
"
f
" • Summary: Sample Issue Title"
)
# Test Cases
print
(
"="
*
70
)
print
(
"TEST 1: Marking PCM-227 done with QA tester from env variable"
)
print
(
"="
*
70
)
result
=
mark_done_and_assign_to_qa_test
(
"PCM-227"
)
print
(
result
)
print
(
"
\n
"
+
"="
*
70
)
print
(
"TEST 2: Marking PCM-226 done with explicit QA tester parameter"
)
print
(
"="
*
70
)
result
=
mark_done_and_assign_to_qa_test
(
"PCM-226"
,
qa_tester
=
"mehreen"
)
print
(
result
)
print
(
"
\n
"
+
"="
*
70
)
print
(
"TEST 3: Marking PCM-225 done - no tester provided, env var not set"
)
print
(
"="
*
70
)
# Simulate env var not being set
original_tester
=
JIRA_QA_TESTER
JIRA_QA_TESTER
=
None
result
=
mark_done_and_assign_to_qa_test
(
"PCM-225"
)
print
(
result
)
JIRA_QA_TESTER
=
original_tester
print
(
"
\n
"
+
"="
*
70
)
print
(
"SUMMARY: Tool Behavior"
)
print
(
"="
*
70
)
print
(
"""
1. ✅ When JIRA_QA_TESTER env var is set:
- Tool uses that tester automatically
- No need to ask user
2. ✅ When qa_tester parameter is provided:
- Tool uses the provided parameter
- Overrides env variable if set
3. ✅ When neither is available:
- Tool returns helpful error message
- Shows list of available QA testers
- Asks user to either:
a) Set JIRA_QA_TESTER environment variable, OR
b) Provide qa_tester parameter directly
4. ✅ Operations performed:
- Transition to "QA Assigned" (Ready for QA)
- Assignment to selected QA tester
- Both in one tool call for efficiency
"""
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment