- Notifications
You must be signed in to change notification settings - Fork3.2k
Add session info to auth_login tool response#1651
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:sammorrowdrums/oauth-device-flow-auth
Are you sure you want to change the base?
Add session info to auth_login tool response#1651
Conversation
- Add middleware to enrich InitializeResult with session information- Include user details (get_me response) in authenticated mode- Include enabled toolsets, tools, read-only mode, and lockdown mode- Handle both authenticated and unauthenticated modes appropriately- Add comprehensive unit tests for the new functionality- Remove suggestion to call get_me from auth_login success messageCo-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
- Replace deprecated gogithub.String/Int64 with gogithub.Ptr- Remove unused parameters from mock handler functionsCo-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
SamMorrowDrums commentedDec 21, 2025
@copilot this is not quite right, it's a good hook initialize, however the meta property is not received by the model, and the host application itself is the bit that knows the configuration so meta won't help it. The idea here was that the model would get a warm start without additional tool calls, so that a newly authenticated session would be clear what the user has (given they don't have the tools to inspect as only auth tool is present), so we were looking at providing it in the main payload. |
- Add GetSessionInfo callback to AuthToolDependencies- Fetch user info and configuration after successful authentication- Display comprehensive session context in auth_login success message- Remove unused middleware functions that were adding to _meta- Revert instructions.go to original (no longer modifying instructions)The auth_login tool now provides the model with:- User account details (username, name, email, company, location, profile URL)- Enabled toolsets and tools- Configuration flags (read-only, lockdown, dynamic toolsets)Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
You're absolutely right! I've updated the implementation to include session information in theauth_login tool's response text instead of _meta or instructions. After successful authentication, the auth_login tool now returns comprehensive session context including:
This provides the model with a "warm start" without requiring an additional tool call. The session info is formatted as readable text in the tool response that the model receives. Changes in commit6d30396. |
Uh oh!
There was an error while loading.Please reload this page.
Summary
The auth_login tool now provides comprehensive session information in its success response, giving the model immediate context about the authenticated user and server configuration without requiring an additional get_me tool call.
Why
Eliminates wasteful get_me tool call after authentication. Provides the model with a "warm start" by including user details and configuration directly in the auth_login response text that the model receives.
What changed
GetSessionInfocallback toAuthToolDependenciesto generate session context after authenticationpollAndCompletefunction to fetch and include user info and configuration in auth_login success messageMCP impact
The auth_login tool's response text now includes comprehensive session information. No schema changes, but the response content is significantly enhanced.
Prompts tested (tool changes only)
N/A - This change enhances the existing auth_login tool's response without altering its invocation or parameters.
Security / limits
User info is fetched using the authenticated token and only included in the auth_login response after successful authentication. Reuses existing get_me endpoint with same permissions.
Lint & tests
./script/lint./script/testDocs
The enhanced response is part of the auth_login tool output and doesn't require documentation changes.
Example
After successful authentication, the auth_login tool returns:
This information is provided directly in the tool response text, which the model receives as part of the conversation, giving it immediate context without requiring a follow-up get_me call.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn moreCopilot coding agent tips in the docs.