Repository navigation
fix(mcp): summarize_containers counts with one /v2/containers/summary call - #418
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
d227b98 to
1069af6
Compare
ee3c3f9 to
f748581
Compare
…mary call The released summarize_containers (1.1.x, from #398) pages the whole filtered container list and counts in the MCP server, capped at max_rows. Rails already has GET /v2/containers/summary (Terminal49/t49#4208, live in production), and reached main. This restores #406 on top of main and covers every dimension the released tool offers, so nothing is lost: - summarize_containers is one SDK call. No paging, no counting, no max_rows. - group_by: current_status, pod_terminal, shipping_line, port_of_discharge, hold_type, pickup_lfd_date, pod_arrival_date. The last three need Terminal49/t49 feat/api-container-summary-more-groups. - SDK: containers.summary(groupBy, filters), with the list's filter validation. A hold_type response may add up to more than total, since a container with two holds counts twice; every other dimension must add up exactly. - OpenAPI: GET /containers/summary with the seven dimensions; SDK types regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They lived in summarize-containers.test.ts, which this PR rewrites for the summary endpoint. list_containers still uses compactContainer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f748581 to
a9820ad
Compare
|
Rebased onto current main (cc26fc5) and pushed with an explicit force-with-lease. Resolved generated-file conflicts by regenerating from OpenAPI and fixed the duplicate paths import introduced by the merge. Compact-row regression coverage is preserved. Also aligned the tool/OpenAPI descriptions with the companion Rails implementation: display-local calendar days with UTC fallback, and current POD hold names including pending holds. Generated SDK/Postman output refreshed. Local validation: build and full lint/type checks pass; 403 MCP, 359 SDK, and 31 CLI tests pass (one SDK live test skipped), plus two Postman-generation tests. Hosted CI is running. Still requires t49 #4294 to be deployed before release. |
|
Final verification at 35e846c: no merge conflicts; 21 hosted checks pass, including workspace checks, SDK/CLI matrices, MCP tests, all six protocol checks, and Vercel. One live-preview smoke check remains red: MCP preview 2026-07-28 cannot discover shipment/container fixtures with the configured CI eval credentials. Reproduced on one retry; the initial preview-URL race is no longer occurring. No tests were skipped or weakened to hide this failure. The failing fixture discovery uses list_shipments/list_containers, not summarize_containers; those handlers and eval code are unchanged by this PR. Investigate the CI eval account/credential and returned tool errors before calling this fully green. No merge performed. |
|
Pushed aa97804: fixture discovery now includes stopped-tracking history and fails explicitly on HTTP/tool errors rather than misreporting them as an empty account. Added four regression tests; seven local eval-support tests and the full monorepo check pass. No live credentials were used locally, and no CI gate was bypassed. Latest CI run 38776533674 isolates the remaining failure: list_shipments returns an MCP tool error. Read-only preview runtime inspection confirms SDK AuthenticationError on the upstream call, with caller authorization passed through. The same fixture-discovery failure also exists on main. The CI eval credential needs to be replaced with a valid key for the intended backend/account before the live gate can pass. Other CI checks pass. This PR is not yet fully green. |
#421 edited the title and description in the generated list-filters.mdx but not in the script that generates it. The next regeneration (#418) put the old metadata back. This change moves #421's metadata into generate-filter-types.mjs and regenerates the page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Why
The
summarize_containerstool released in MCP 1.1.0/1.1.1 (#411, built from umbrella PR #398) pages the entire filtered container list and counts inside the MCP server, capped atmax_rows(3000 by default). On large accounts that means many API calls, counts that hit the cap, and a "total" that can benull.That isn't how it was meant to ship. #406 moved the tool onto Rails
GET /v2/containers/summary(Terminal49/t49#4208, now live in production): one query, the same filters aslist_containers, and an exact total. But #406 merged into #405's branch, and the #398 version reachedmaininstead. Nobody clearly owned the final merge, so the difference went unnoticed.What
The rule is no counting in the MCP. Every dimension is counted by Rails.
packages/mcp/src/tools/summarize-containers.tsmakes oneclient.containers.summary(group_by, filters)call. Paging,max_rowsand the in-processgroupKeyscounting are gone.group_bykeeps every dimension the released tool had and adds one:current_status,pod_terminal,shipping_line,port_of_discharge,hold_type,pickup_lfd_date,pod_arrival_date.containers.summary()reuses the list's filter validation and checks the response shape. Ahold_typeresponse may add up to more thantotal, since a container with two holds counts twice. Every other dimension must add up exactly.GET /containers/summarylists all seven dimensions, and the SDK types are regenerated from it.{ total, group_by, truncated, groups: [{ key, label, count }] }. A null key means the container has no value (no hold, LFD or arrival).list_parties(#407) and the compact-row fixes on #404/#405 are out of scope here. They need their own pass.Tests
tsc --noEmitare clean.hold_typetotal-contract tests.Rollout
Leave this as a draft until it's approved and #4294 is deployed. Don't release it before then.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.The PR appears safe to merge, with a non-blocking request to preserve the compact-row regression tests.
Fix with agent prompt
Summary
summarize_containersnow gets counts from one Rails request instead of paging and counting containers inside MCP.Acknowledgments:
alosecexplicitly states thathold_type,pickup_lfd_date, andpod_arrival_daterequire Terminal49/t49#4294 and that release must wait for its deployment.alosecalso deferslist_partiesand compact-row fixes to separate work. These are not reported as findings.Diagram
Reviews (1) · Last reviewed commit: "chore: Auto-generate Postman collection ..." · Reviewed by Greptile