Skip to content

fix(aws-healthomics-mcp-server): compute returnedCount from known result-list keys - #4852

Open
mangeshraut712 wants to merge 6 commits into
awslabs:mainfrom
mangeshraut712:fix/healthomics-returned-count-key-order
Open

mangeshraut712 wants to merge 6 commits into
awslabs:mainfrom
mangeshraut712:fix/healthomics-returned-count-key-order

Conversation

@mangeshraut712

@mangeshraut712 mangeshraut712 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4669

Summary

Changes

The pagination wrapper set returnedCount from the first list-valued field in the response, in insertion order. SearchGenomicsFiles also returns storage_systems_searched, a list of metadata, so when that key came first the count reported the number of storage systems instead of the number of results.

returnedCount is now taken from a fixed set of known result-list keys (results, workflows, runs, readSets, and the others the paginated tools in this server return). Responses without one of those keys still report 0, as before.

User experience

Before: a search page with 3 results could report returnedCount: 2 because it counted ['s3', 'efs']. After: it reports 3.

Checklist

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Tests: added a regression test with a search response whose metadata list comes before results. uv run --frozen pytest tests/test_pagination_hints.py passes (16 tests).

Is this a breaking change? (Y/N) N

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Fixes #4669

Why: returnedCount used the first list-valued field in the response dict. When a metadata list (e.g. storage_systems_searched) appeared before the real results key, the hint counted the wrong list.

What: Replace positional first-list scanning with a documented allowlist of known HealthOmics result-list keys (_RESULT_LIST_KEYS). Unknown shapes report returnedCount: 0 instead of guessing.

Test:

cd src/aws-healthomics-mcp-server
uv run pytest tests/test_pagination_hints.py tests/test_pagination_hints_real_shapes.py
# 25 passed

Added regression: metadata list precedes results; count uses results.

@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Green and ready — happy to adjust anything.

@mangeshraut712

Copy link
Copy Markdown
Contributor Author

@markjschreiber @WIIASD @a-li @alxawan @MaisiLi CI is green and the contributor statement check is passing. It computes returnedCount from known result-list keys instead of the first list-valued field, so metadata lists do not inflate the count. If it looks good, could you please review and merge when you get a chance? Thanks.

@mangeshraut712

Copy link
Copy Markdown
Contributor Author

CI is green. Computes returnedCount from known result-list keys. Please review and merge when you can.

@mangeshraut712
mangeshraut712 force-pushed the fix/healthomics-returned-count-key-order branch from 90eae06 to 6d4b582 Compare October 27, 2026 14:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

aws-healthomics-mcp-server: pagination returnedCount depends on response key insertion order

1 participant