feat(pico): pass client metadata to inbound context
Allows Pico clients to include a metadata object in message payloads. String values are merged into the channel metadata, enabling clients to pass headers (e.g., mcp:Authorization) that flow through to MCP tool calls via the dynamic headers mechanism. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a66fbbef0c
commit
b92a21eb04
1 changed files with 8 additions and 0 deletions
|
|
@ -948,6 +948,14 @@ func (c *PicoChannel) handleMessageSend(pc *picoConn, msg PicoMessage) {
|
|||
"conn_id": pc.id,
|
||||
}
|
||||
|
||||
if payloadMeta, ok := msg.Payload["metadata"].(map[string]any); ok {
|
||||
for k, v := range payloadMeta {
|
||||
if s, ok := v.(string); ok && s != "" {
|
||||
metadata[k] = s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.DebugCF("pico", "Received message", map[string]any{
|
||||
"session_id": sessionID,
|
||||
"preview": truncate(content, 50),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue