Explorer

definy.mcp-whoami

description
The definy_whoami MCP tool
type
Fn(arguments: @definy.json, request: @http.request) -> @definy.service-io
expression
fn(arguments$0, request$1) =>
  #read_mcp_account<@definy.service-io>({
    then: fn(account$2) =>
      match $2 {
        #none(_) =>
          @definy.mcp-text(
            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$3) =>
          @definy.read-account-created(
            account_id: $3.account_id,
            offset: 0,
            then: fn(created$4) =>
              @definy.mcp-text(
                text: @std.string-join(
                  items: [
                    "account id: ",
                    $3.account_id,
                    "\naccount name: ",
                    $3.account_name,
                    "\ncreated on this server: ",
                    match $4 {
                      true =>
                        "yes",
                      false =>
                        "no (it is created on the first write)"
                    }
                  ],
                  separator: ""
                )
              )
          )
      }
  })
visibility
public
definy.mcp-whoami (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: OeS0UUz35D7E6XEjf1Uleoh3jn6aFvtDEFwP1zbIPiI
content hash: QKKd7540cdBlGUJmZqnZ9JuWSjR162yDtr2EX5wBaDA