-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(sdk-python): add get_context_usage() method #6471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -482,6 +482,14 @@ async def mcp_server_status(self) -> dict[str, Any] | None: | |
| await self._ensure_started() | ||
| return await self._send_control_request("mcp_server_status") | ||
|
|
||
| async def get_context_usage( | ||
| self, show_details: bool = False | ||
| ) -> dict[str, Any] | None: | ||
| await self._ensure_started() | ||
| return await self._send_control_request( | ||
| "get_context_usage", {"show_details": show_details} | ||
| ) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] No tests were added for Additionally, the integration test mock in Suggested additions:
— qwen3.7-max via Qwen Code /review |
||
|
|
||
| @property | ||
| def control_request_timeout(self) -> float: | ||
| return self._options.timeout.control_request | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] The async
Queryclass now hasget_context_usage(), butSyncQueryinsync_query.pyis missing the corresponding sync wrapper. Every other control-request method (supported_commands,mcp_server_status,set_model,set_permission_mode) has a sync counterpart. Sync SDK consumers currently have no way to call this new feature.Consider adding to
SyncQuery(aftermcp_server_status):— qwen3.7-max via Qwen Code /review