30 lines
1.2 KiB
C
30 lines
1.2 KiB
C
/* The Novox Mesh SDK for C — the skeleton (novox/hq ADR 0188).
|
|
*
|
|
* A tools bundle is a process the node's runtime launches and speaks MCP over stdio to:
|
|
* `initialize`, `tools/list` once, `tools/call` per call, newline-framed JSON-RPC on stdin and
|
|
* stdout. This is the loop, so a bundle writes its tools and nothing else. A tool named
|
|
* `<seat>.<verb>` is the module's implementation of that seat's verb; any other name is the
|
|
* module's own. JSON is jansson's.
|
|
*
|
|
* No transport here: the bus, the subjects and the memberships are the runtime's (ADR 0039, 0175).
|
|
* stdout is the protocol; log to stderr. */
|
|
#ifndef MESH_SDK_H
|
|
#define MESH_SDK_H
|
|
#include <jansson.h>
|
|
|
|
#define MESH_SDK_PROTOCOL "2025-03-26"
|
|
|
|
/* One tool. `run` returns a new JSON value (the answer) or NULL with *error set to a message the
|
|
* caller frees. `input` is the schema of the arguments, or NULL for a tool that takes nothing. */
|
|
typedef struct {
|
|
const char *name;
|
|
const char *description;
|
|
json_t *input;
|
|
json_t *(*run)(json_t *args, char **error);
|
|
} mesh_tool;
|
|
|
|
/* Serve these tools on stdin/stdout until stdin closes. Returns 0, or -1 on an I/O fault. */
|
|
int mesh_serve(const char *name, const mesh_tool *tools, size_t count);
|
|
|
|
#endif
|