(payload: string)
| 20 | const decode = Schema.decodeUnknownEffect(Schema.fromJsonString(McpResult)) |
| 21 | |
| 22 | const parsePayload = (payload: string) => |
| 23 | Effect.gen(function* () { |
| 24 | const trimmed = payload.trim() |
| 25 | if (!trimmed.startsWith("{")) return undefined |
| 26 | const data = yield* decode(trimmed) |
| 27 | return data.result.content.find((item) => item.text)?.text |
| 28 | }) |
| 29 | |
| 30 | export const parseResponse = Effect.fn("McpWebSearch.parseResponse")(function* (body: string) { |
| 31 | const trimmed = body.trim() |
no test coverage detected