Came up while reviewing the Sentry adapter in #551 and it applies to GitHub, GitLab, Shopify and most APIs that paginate with a Link header or return rate limit info in headers.
Today the REST engine returns only the response body to the tool. A list tool can accept a cursor parameter, but the model never sees the next cursor because it lives in Link: <...&cursor=xyz>; rel="next". So every list tool is effectively one page, and adapter authors either document the limit (as #551 does) or invent workarounds.
What I'd like:
- an opt in per tool, something like
"exposeHeaders": ["link", "x-ratelimit-remaining"] in the endpoint mapping, so we don't bloat every response
- the selected headers appended to the tool result, probably as a small
_headers object in the structured content and a one line note in the text content
- for the
Link case specifically, parse rel="next" into a nextCursor (or nextUrl) field so the model can call the same tool again without string surgery
Things to keep in mind: response mapping should still apply to the body only, and the audit log shouldn't grow because of this, headers are small but multiply by 22k tools quickly if we log them all.
If someone wants to pick this up, packages/backend/src/connectors/engines/rest.engine.ts is where the response gets shaped, and nominatim.live.spec.ts shows how we do live tests behind a flag.
Came up while reviewing the Sentry adapter in #551 and it applies to GitHub, GitLab, Shopify and most APIs that paginate with a
Linkheader or return rate limit info in headers.Today the REST engine returns only the response body to the tool. A list tool can accept a
cursorparameter, but the model never sees the next cursor because it lives inLink: <...&cursor=xyz>; rel="next". So every list tool is effectively one page, and adapter authors either document the limit (as #551 does) or invent workarounds.What I'd like:
"exposeHeaders": ["link", "x-ratelimit-remaining"]in the endpoint mapping, so we don't bloat every response_headersobject in the structured content and a one line note in the text contentLinkcase specifically, parserel="next"into anextCursor(ornextUrl) field so the model can call the same tool again without string surgeryThings to keep in mind: response mapping should still apply to the body only, and the audit log shouldn't grow because of this, headers are small but multiply by 22k tools quickly if we log them all.
If someone wants to pick this up,
packages/backend/src/connectors/engines/rest.engine.tsis where the response gets shaped, andnominatim.live.spec.tsshows how we do live tests behind a flag.