Explorer

definy.mcp-get-project

description
The definy_get_project MCP tool
type
Fn(arguments: @definy.json, request: @http.request) -> @definy.service-io
expression
fn(arguments$0, request$1) =>
  let project$2 = match @definy.json-get-string(value: $0, key: "project") {
      #some(text$3) =>
        $3,
      #none(_) =>
        ""
    };
  let branch$4 = match @definy.json-get-string(value: $0, key: "branch") {
      #some(text$5) =>
        $5,
      #none(_) =>
        "main"
    };
  match @core.equal(left: $2, right: "") {
    true =>
      @definy.mcp-text-error(text: "project is required"),
    false =>
      @definy.read-branch-snapshot(
        project: $2,
        branch: $4,
        then: fn(commit$6, commits$7) =>
          match $6 {
            #none(_) =>
              @definy.mcp-text-error(
                text: @std.string-join(
                  items: ["Branch ", $4, " of project ", $2, " was not found (definy_get_project_branches lists them)"],
                  separator: ""
                )
              ),
            #some(found$8) =>
              @definy.read-part-contents(
                parts: @definy.snapshot-parts(modules: $8.commit.modules, index: 0),
                then: fn(parts$9) =>
                  @definy.mcp-text(
                    text: @definy.mcp-project-text(
                      commit: $8,
                      parts: $9,
                      names: @definy.snapshot-part-names(commits: @core.list-concat(left: [$8], right: @definy.latest-main-snapshots(commits: $7)))
                    )
                  )
              )
          }
      )
  }
visibility
public
definy.mcp-get-project (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: PC3CboGJ1dkarbxQT9erwn-rdJ3jwyec4x0VdbR022o
content hash: 7LOPd1YOoQaG43bsq-CevxCvotv8bchvgVPLa5mTg94