Add GetAuthorizedMap Method to Context for Authorization Data Retrieval

- Implemented GetAuthorizedMap method in the Context struct to return authorized information as a map.
- This method adheres to the AuthorizedProvider interface, facilitating authorization context access for MCP process calls.
- Enhances the ability of MCP tools to receive and utilize authorization data during Process transport interactions.
This commit is contained in:
Max 2025-12-25 10:16:23 +08:00
parent 8aa373b969
commit 97d0ad1d24

View file

@ -122,6 +122,16 @@ func (ctx *Context) Release() {
}
}
// GetAuthorizedMap returns the authorized information as a map
// This implements the AuthorizedProvider interface for MCP process calls
// Allows MCP tools to receive authorization context when called via Process transport
func (ctx *Context) GetAuthorizedMap() map[string]interface{} {
if ctx.Authorized == nil {
return nil
}
return ctx.Authorized.AuthorizedToMap()
}
// Send sends data to the context's writer
// This is used by the output module to send messages to the client
// func (ctx *Context) Send(data []byte) error {