Skip widget, session URL, and page_size prompt for internal clients#240
Skip widget, session URL, and page_size prompt for internal clients#240
Conversation
Detect requests from EveryRow CC (via User-Agent) and strip widget JSON, session URL references, and submission widget from responses. This saves bandwidth and context tokens for our own app which has its own UI. Also adds auto_page_size_threshold setting (default 50, configurable via AUTO_PAGE_SIZE_THRESHOLD env var) — when total rows are at or below the threshold, the agent loads all rows directly instead of asking the user. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@claude code review |
|
Claude finished @RafaelPo's task in 1m 55s —— View job Code ReviewReviewed all 7 changed files. The core design — extracting Bug:
|
- Guard against total=0 producing page_size=0 (fails ge=1 validation) - Add "everyrow-cc" to _NO_WIDGET_UA_SUBSTRINGS so client_supports_widgets is self-consistent without needing an override in the results handler Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| def is_internal_client() -> bool: | ||
| """Return True if the request comes from EveryRow's own app (CC).""" | ||
| from everyrow_mcp.http_config import get_user_agent # noqa: PLC0415 | ||
|
|
||
| return "everyrow-cc" in get_user_agent().lower() |
There was a problem hiding this comment.
What happens if you run the MCP in Claude Code now? Is that not also going to have the same problem? Is it possible to do this where such that it's json by default, and it's the HTML-requiring clients (e.g. the connector) that announce themselves?
Summary
User-Agent: everyrow-ccand skip widget JSON, session URL, and submission widget from all responses (submission, progress, results)auto_page_size_thresholdsetting (default 50, envAUTO_PAGE_SIZE_THRESHOLD) — when total rows <= threshold, agent loads all rows directly instead of asking the user for page_sizeTest plan
User-Agent: everyrow-cc/1.0— no widget JSON, no session_url, no "ask the user" prompt for small resultsUser-Agent: claude-code/2.1— no widget (existing behavior), session_url still present🤖 Generated with Claude Code