(envelope: Option.Option<JsonRpcEnvelope>)
| 192 | }; |
| 193 | |
| 194 | const rpcAttrs = (envelope: Option.Option<JsonRpcEnvelope>): Record<string, unknown> => |
| 195 | Option.match(envelope, { |
| 196 | onNone: () => ({}), |
| 197 | onSome: (e) => ({ |
| 198 | ...(e.method && { "mcp.rpc.method": e.method }), |
| 199 | ...(e.id !== undefined && e.id !== null && { "mcp.rpc.id": String(e.id) }), |
| 200 | ...methodAttrs(e), |
| 201 | ...replyAttrs(e), |
| 202 | }), |
| 203 | }); |
| 204 | |
| 205 | export const annotateMcpRequest = ( |
| 206 | request: Request, |
no test coverage detected