fn(request$0) =>
match @core.equal(left: @http.method-text(method: $0.method), right: "POST") {
false =>
#done<@definy.service-io>(#respond({
status: 405,
headers: @core.list-concat(left: [{name: "Allow", value: "POST"}], right: @definy.cors-headers),
body: #text<@definy.http-body>("Method Not Allowed")
})),
true =>
match @definy.request-json-of(request: $0) {
#json(json$2) =>
@definy.mcp-handle-message(message: $2, request: $0),
#invalid(message$3) =>
@definy.mcp-error(
status: 400,
id: #null<@definy.json>,
code: @core.minus(left: 0, right: 32700),
message: @core.string-concat(left: "Parse error: ", right: $3)
)
}
}