From 97d0ad1d242506f1164183b98236b32507eb22f6 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 25 Dec 2025 10:16:23 +0800 Subject: [PATCH] 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. --- agent/context/context.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/agent/context/context.go b/agent/context/context.go index 71062bd5..74862779 100644 --- a/agent/context/context.go +++ b/agent/context/context.go @@ -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 {