package mcp-kit

All checked builds pass
  1. Overview
  2. Docs
OCaml library for building MCP servers

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ocaml-mcp-v0.2.0.tar.gz
sha256=43c8319a13be91e323ae952a71ab673533fb3295886029eed9d81e5828de5ef7

doc/src/mcp-kit.jsonschema-core/schema.ml.html

Source file schema.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(** JSON Schema representation.

    A schema MUST be an object or a boolean. *)

type t = Bool of bool | Obj of Yojson.Safe.t

let of_json (j : Yojson.Safe.t) =
  match j with
  | `Bool b -> Ok (Bool b)
  | `Assoc _ -> Ok (Obj j)
  | _ -> Error "schema must be an object or a boolean"

let keyword key = function
  | Bool _ -> None
  | Obj (`Assoc pairs) -> List.assoc_opt key pairs
  | Obj _ -> None

let keywords = function
  | Bool _ -> []
  | Obj (`Assoc pairs) -> List.map fst pairs
  | Obj _ -> []