fix: Return -1 for missing metadata in Jira Cloud search (#333) #360
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Refs #333
This PR addresses an issue where the
jira_search
tool incorrectly reportedtotal
andmax_results
values equal to the requestedlimit
in Jira Cloud environments. The root cause was identified as:enhanced_jql
API endpoint used byatlassian-python-api
does not includetotal
,startAt
,maxResults
fields in responsesJiraSearchResult
model validator incorrectly overwrote these missing values with the current page's issue counttotal
to get the correct count even if it's a cloud in a separate API callNote: While we could implement direct REST API calls to get this metadata, we're maintaining our dependency on
atlassian-python-api
as it provides consistent JQL support across Server/DC environments and underlies most of our other Jira integrations. The metadata limitation will be handled by returning-1
for unavailable values until direct REST API implementation becomes a critical requirement.Changes
@model_validator
logic inJiraSearchResult
that overwrote metadata valuesJiraSearchResult.from_api_response
to return-1
for missing/invalid metadata fields-1
metadata values in Cloud responsesTesting
test_from_api_response_missing_metadata
toTestJiraSearchResult
test_call_tool_success
in server tests for new metadata behaviormcp-inspector
thatjira_search
returns-1
for metadata in Cloud environmentChecklist
-1
values as known limitation in Cloud environments and rationale for maintaining current library dependency