(envelope: Option.Option<JsonRpcEnvelope>)
| 172 | }; |
| 173 | |
| 174 | const rpcAttrs = (envelope: Option.Option<JsonRpcEnvelope>): Record<string, unknown> => |
| 175 | Option.match(envelope, { |
| 176 | onNone: () => ({}), |
| 177 | onSome: (e) => ({ |
| 178 | ...(e.method && { "mcp.rpc.method": e.method }), |
| 179 | ...(e.id !== undefined && e.id !== null && { "mcp.rpc.id": String(e.id) }), |
| 180 | ...methodAttrs(e), |
| 181 | ...replyAttrs(e), |
| 182 | }), |
| 183 | }); |
| 184 | |
| 185 | export const annotateMcpRequest = ( |
| 186 | request: Request, |
no test coverage detected