fn(then$0) =>
#read_mcp_account<@definy.service-io>({
then: fn(account$1) =>
match $1 {
#none(_) =>
@definy.mcp-text-error(
text: "Writing is disabled on this server: set the secrets DEFINY_MCP_ACCOUNT_SECRET_KEY and DEFINY_MCP_ACCOUNT_NAME (docs/mcp.md)"
),
#some(found$2) =>
@definy.read-account-created(
account_id: $2.account_id,
offset: 0,
then: fn(created$3) =>
match $3 {
true =>
$0(account: $2),
false =>
@definy.mcp-submit-content(
account: $2,
content: #create_account<@core.event-content>({account_name: $2.account_name}),
after_time_ms: 0,
then: fn(accepted$4, text$5) =>
match $4 {
true =>
$0(account: $2),
false =>
@definy.mcp-text-error(text: @core.string-concat(left: "Could not create the MCP account: ", right: $5))
}
)
}
)
}
})