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:
Andy Lo-A-Foe 2026-04-29 21:21:26 +02:00
parent a66fbbef0c
commit b92a21eb04
No known key found for this signature in database
GPG key ID: C0E4EB79E9E6A23D

View file

@ -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),