ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
mcp-server/protocol.c
Go to the documentation of this file.
1#include "mcp.h"
5#include <ascii-chat/version.h>
7#include <string.h>
8
9static yyjson_mut_doc *envelope(yyjson_val *id) {
10 yyjson_mut_doc *d = yyjson_mut_doc_new(NULL);
11 yyjson_mut_val *root = yyjson_mut_obj(d);
12 yyjson_mut_doc_set_root(d, root);
13 yyjson_mut_obj_add_str(d, root, "jsonrpc", "2.0");
14 yyjson_mut_obj_add_val(d, root, "id",
15 id ? yyjson_val_mut_copy(d, id) : yyjson_mut_null(d));
16 return d;
17}
18yyjson_mut_doc *mcp_error(yyjson_val *id, int code, const char *message) {
19 ASCII_OTEL_SCOPE(MCP_PROTOCOL_ERROR);
20 ASCII_OTEL_ATTR_INT("rpc.jsonrpc.error_code", code);
22 ascii_otel_error("MCP protocol request rejected");
23 yyjson_mut_doc *d = envelope(id);
24 yyjson_mut_val *e = yyjson_mut_obj(d);
25 yyjson_mut_obj_add_int(d, e, "code", code);
26 yyjson_mut_obj_add_strcpy(d, e, "message", message);
27 yyjson_mut_obj_add_val(d, yyjson_mut_doc_get_root(d), "error", e);
28 return d;
29}
30static yyjson_mut_doc *tool_result(yyjson_val *id,
32 yyjson_mut_doc *d = envelope(id);
33 yyjson_mut_val *root = yyjson_mut_doc_get_root(d),
34 *result = yyjson_mut_obj(d), *content = yyjson_mut_arr(d),
35 *item = yyjson_mut_obj(d);
36 yyjson_mut_obj_add_str(d, item, "type", "text");
37 const char *text = r->error[0] ? r->error
38 : r->text && r->text[0] ? r->text
39 : r->output_path;
40 yyjson_mut_obj_add_strcpy(d, item, "text", text ? text : "");
41 yyjson_mut_arr_add_val(content, item);
42 yyjson_mut_obj_add_val(d, result, "content", content);
43 yyjson_mut_obj_add_bool(d, result, "isError", r->error[0] != 0);
44 if (!r->error[0]) {
45 yyjson_mut_val *data = yyjson_mut_obj(d), *files = yyjson_mut_arr(d),
46 *frames = yyjson_mut_arr(d);
47 yyjson_mut_obj_add_strcpy(d, data, "ascii", r->text ? r->text : "");
48 yyjson_mut_obj_add_uint(d, data, "elapsed_ms", r->elapsed_ms);
49 for (size_t i = 0; i < r->frame_count; ++i) {
50 const http_render_frame_t *source = &r->frames[i];
51 yyjson_mut_val *frame = yyjson_mut_obj(d);
52 if (source->text) {
53 yyjson_mut_obj_add_str(d, frame, "type", "text");
54 yyjson_mut_obj_add_strcpy(d, frame, "text", source->text);
55 } else {
56 yyjson_mut_obj_add_str(d, frame, "type", "file");
57 yyjson_mut_obj_add_strcpy(d, frame, "path", source->path);
58 }
59 yyjson_mut_obj_add_uint(d, frame, "timestamp_ms", source->timestamp_ms);
60 yyjson_mut_arr_add_val(frames, frame);
61 }
62 if (r->output_path[0]) {
63 yyjson_mut_arr_add_strcpy(d, files, r->output_path);
64 yyjson_mut_val *frame = yyjson_mut_obj(d);
65 yyjson_mut_obj_add_str(d, frame, "type", "file");
66 yyjson_mut_obj_add_strcpy(d, frame, "path", r->output_path);
67 yyjson_mut_arr_add_val(frames, frame);
68 }
69 yyjson_mut_obj_add_val(d, data, "saved_files", files);
70 yyjson_mut_obj_add_val(d, data, "frames", frames);
71 yyjson_mut_obj_add_val(d, result, "structuredContent", data);
72 }
73 yyjson_mut_obj_add_val(d, root, "result", result);
74 return d;
75}
76
77// Enumerate through the same platform APIs as the CLI, without opening capture
78// streams.
79static yyjson_mut_doc *device_list_result(yyjson_val *id,
80 yyjson_val *arguments) {
81 if (arguments && (!yyjson_is_obj(arguments) || yyjson_obj_size(arguments)))
82 return mcp_error(id, -32602, "device_list accepts no arguments");
83 yyjson_mut_doc *d = envelope(id);
84 yyjson_mut_val *result = yyjson_mut_obj(d), *data = yyjson_mut_obj(d),
85 *video = yyjson_mut_arr(d), *audio = yyjson_mut_arr(d),
86 *errors = yyjson_mut_arr(d);
87 webcam_device_info_t *cameras = NULL;
88 audio_device_info_t *microphones = NULL;
89 unsigned camera_count = 0, microphone_count = 0;
90 int default_video = -1, default_audio = -1;
91 asciichat_error_t err = webcam_list_devices(&cameras, &camera_count);
92 if (err != ASCIICHAT_OK) {
94 yyjson_mut_arr_add_strcpy(d, errors,
95 HAS_ERRNO(&context) ? context.context_message
96 : "Cannot enumerate webcams");
97 } else {
98 for (unsigned i = 0; i < camera_count; ++i) {
99 yyjson_mut_val *device = yyjson_mut_obj(d);
100 bool is_default = cameras[i].index == 0;
101 if (is_default)
102 default_video = (int)cameras[i].index;
103 yyjson_mut_obj_add_uint(d, device, "index", cameras[i].index);
104 yyjson_mut_obj_add_strcpy(d, device, "name", cameras[i].name);
105 yyjson_mut_obj_add_bool(d, device, "is_default", is_default);
106 yyjson_mut_arr_add_val(video, device);
107 }
108 }
110 err = audio_list_input_devices(&microphones, &microphone_count);
111 if (err != ASCIICHAT_OK) {
113 yyjson_mut_arr_add_strcpy(d, errors,
114 HAS_ERRNO(&context)
115 ? context.context_message
116 : "Cannot enumerate microphones");
117 } else {
118 for (unsigned i = 0; i < microphone_count; ++i) {
119 yyjson_mut_val *device = yyjson_mut_obj(d);
120 if (microphones[i].is_default_input)
121 default_audio = microphones[i].index;
122 yyjson_mut_obj_add_int(d, device, "index", microphones[i].index);
123 yyjson_mut_obj_add_strcpy(d, device, "name", microphones[i].name);
124 yyjson_mut_obj_add_bool(d, device, "is_default",
125 microphones[i].is_default_input);
126 yyjson_mut_arr_add_val(audio, device);
127 }
128 }
129 audio_free_device_list(microphones);
130 yyjson_mut_obj_add_val(d, data, "video_devices", video);
131 yyjson_mut_obj_add_val(d, data, "audio_devices", audio);
132 yyjson_mut_obj_add_val(d, data, "default_video_device",
133 default_video < 0 ? yyjson_mut_null(d)
134 : yyjson_mut_int(d, default_video));
135 yyjson_mut_obj_add_val(d, data, "default_audio_device",
136 default_audio < 0 ? yyjson_mut_null(d)
137 : yyjson_mut_int(d, default_audio));
138 yyjson_mut_obj_add_val(d, data, "errors", errors);
139 yyjson_mut_val *content = yyjson_mut_arr(d), *item = yyjson_mut_obj(d);
140 char *text = yyjson_mut_val_write(data, 0, NULL);
141 yyjson_mut_obj_add_str(d, item, "type", "text");
142 yyjson_mut_obj_add_strcpy(d, item, "text",
143 text ? text : "Cannot serialize device list");
144 free(text);
145 yyjson_mut_arr_add_val(content, item);
146 yyjson_mut_obj_add_val(d, result, "content", content);
147 yyjson_mut_obj_add_bool(d, result, "isError",
148 yyjson_mut_arr_size(errors) != 0);
149 yyjson_mut_obj_add_val(d, result, "structuredContent", data);
150 yyjson_mut_obj_add_val(d, yyjson_mut_doc_get_root(d), "result", result);
151 return d;
152}
153static void run_job(void *arg, atomic_t *cancelled) {
154 mcp_job_t *job = arg;
155 ASCII_OTEL_SCOPE_PARENT(MCP_RENDER, &job->telemetry_parent);
156 static const char *const tools[] = {"render_file", "render_url",
157 "render_webcam", "render_visualization"};
158 ASCII_OTEL_ATTR_STRING("mcp.tool", tools[job->tool]);
159 ASCII_OTEL_ATTR_STRING("mcp.transport",
160 job->server->policy.hosted ? "http" : "stdio");
163 uint64_t render_started = time_get_ns();
164 log_info("MCP render started");
166 (job->request.source_path[0] || job->request.source_url[0])) {
167 http_render_request_t shared_request;
168 http_render_request_init(&shared_request);
169 shared_request.source.type = job->request.source_url[0]
172 if (job->request.source_url[0])
173 SAFE_STRNCPY(shared_request.source.url, job->request.source_url,
174 sizeof(shared_request.source.url));
175 else
176 SAFE_STRNCPY(shared_request.source.path, job->request.source_path,
177 sizeof(shared_request.source.path));
178 shared_request.options = job->request.options;
179 http_render_result_t shared_result = {0};
180 const char *shared_source = job->request.source_url[0]
181 ? job->request.source_url
182 : job->request.source_path;
184 shared_source, &shared_request, &shared_result, cancelled);
185 memset(&result, 0, sizeof(result));
186 result.elapsed_ms = shared_result.elapsed_ms;
187 if (shared_error == ASCIICHAT_OK) {
188 result.text = shared_result.ascii;
189 result.length = shared_result.ascii_length;
190 shared_result.ascii = NULL;
191 } else {
192 SAFE_STRNCPY(result.error, asciichat_error_string(shared_error),
193 sizeof(result.error));
194 }
195 http_render_result_destroy(&shared_result);
196 } else {
197 http_renderer_process(&job->request, cancelled, &result);
198 }
200 time_get_ns() - render_started);
202 result.length);
203 ASCII_OTEL_ATTR_INT("mcp.output.bytes", (int64_t)result.length);
204 if (result.error[0]) {
206 1);
207 const char *failure = result.timed_out ? "timeout"
208 : atomic_load_bool(cancelled) ? "cancelled"
209 : "render";
210 ASCII_OTEL_ATTR_STRING("error.type", failure);
211 if (result.timed_out)
213 else if (atomic_load_bool(cancelled))
215 SET_ERRNO(ERROR_FILE_OPERATION, "MCP render failed: %s", result.error);
216 log_error("MCP render failed: %s", result.error);
217 } else
218 log_info("MCP render completed in %llu ms",
219 (unsigned long long)result.elapsed_ms);
220 if (!result.error[0] && result.output_path[0])
222 job->response =
223 tool_result(mcp_get(yyjson_doc_get_root(job->message), "id"), &result);
226 if (!job->server->policy.hosted) {
227 mcp_stdio_send(job->server, job->response);
228 yyjson_mut_doc_free(job->response);
229 job->response = NULL;
230 }
231 if (job->server->policy.hosted) {
232 // The HTTP wakeup runs on the server loop and must observe completion.
234 mcp_http_wake(job->server);
235 }
236}
237void mcp_jobs_reap(mcp_server_t *s, bool all) {
238 for (unsigned i = 0; i < s->policy.max_jobs; ++i) {
239 mcp_job_t *j = &s->jobs[i];
240 if (!j->renderer_job.started ||
241 (!all && (!http_renderer_job_is_done(&j->renderer_job) ||
242 (s->policy.hosted && j->connection))))
243 continue;
245 yyjson_doc_free(j->message);
246 if (j->response)
247 yyjson_mut_doc_free(j->response);
248 memset(j, 0, sizeof(*j));
249 }
250}
251static bool same_id(yyjson_val *a, yyjson_val *b) {
252 return a && b &&
253 ((yyjson_is_str(a) && yyjson_is_str(b) &&
254 yyjson_get_len(a) == yyjson_get_len(b) &&
255 !strcmp(yyjson_get_str(a), yyjson_get_str(b))) ||
256 (yyjson_is_int(a) && yyjson_is_int(b) &&
257 yyjson_get_sint(a) == yyjson_get_sint(b)));
258}
259yyjson_mut_doc *mcp_dispatch(mcp_server_t *s, yyjson_doc *message,
260 void *connection, const char *session_id,
261 bool *pending) {
262 ASCII_OTEL_SCOPE(MCP_REQUEST);
263 ASCII_OTEL_ATTR_STRING("rpc.system", "jsonrpc");
264 ASCII_OTEL_ATTR_STRING("mcp.transport", s->policy.hosted ? "http" : "stdio");
266 *pending = false;
267 yyjson_val *root = yyjson_doc_get_root(message), *id = mcp_get(root, "id"),
268 *method = mcp_get(root, "method"),
269 *version = mcp_get(root, "jsonrpc");
270 if (!yyjson_is_obj(root) || !yyjson_is_str(version) ||
271 strcmp(yyjson_get_str(version), "2.0") || !yyjson_is_str(method) ||
272 strlen(yyjson_get_str(method)) != yyjson_get_len(method) ||
273 (id && !yyjson_is_str(id) && !yyjson_is_int(id)))
274 return mcp_error(id, -32600, "Invalid JSON-RPC request");
275 const char *name = yyjson_get_str(method);
276 static const char *const methods[] = {"initialize",
277 "ping",
278 "tools/list",
279 "tools/call",
280 "notifications/initialized",
281 "notifications/cancelled"};
282 const char *method_name = "unknown";
283 for (size_t i = 0; i < sizeof(methods) / sizeof(methods[0]); i++)
284 if (!strcmp(name, methods[i]))
285 method_name = methods[i];
286 ASCII_OTEL_ATTR_STRING("rpc.method", method_name);
287 yyjson_val *params = mcp_get(root, "params");
288 if (params && !yyjson_is_obj(params))
289 return id ? mcp_error(id, -32602, "params must be an object") : NULL;
290 if (!id) {
291 if (!strcmp(name, "notifications/initialized"))
292 s->initialized = true;
293 if (!strcmp(name, "notifications/cancelled")) {
294 yyjson_val *cancel = mcp_get(params, "requestId");
295 for (unsigned i = 0; i < s->policy.max_jobs; ++i)
296 if (s->jobs[i].renderer_job.started &&
297 (!s->policy.hosted ||
298 (session_id && *session_id &&
299 !strcmp(s->jobs[i].session_id, session_id)) ||
300 ((!session_id || !*session_id) &&
301 s->jobs[i].connection == connection)) &&
302 same_id(cancel,
303 mcp_get(yyjson_doc_get_root(s->jobs[i].message), "id")))
305 }
306 return NULL;
307 }
308 yyjson_mut_doc *d = envelope(id);
309 yyjson_mut_val *result = yyjson_mut_obj(d);
310 yyjson_mut_obj_add_val(d, yyjson_mut_doc_get_root(d), "result", result);
311 if (!strcmp(name, "initialize")) {
312 yyjson_val *requested = mcp_get(params, "protocolVersion");
313 const char *v = yyjson_get_str(requested);
314 if (!v || (strcmp(v, "2025-11-25") && strcmp(v, "2025-06-18") &&
315 strcmp(v, "2025-03-26")))
316 v = "2025-11-25";
317 yyjson_mut_obj_add_strcpy(d, result, "protocolVersion", v);
318 yyjson_mut_val *caps = yyjson_mut_obj(d), *info = yyjson_mut_obj(d);
319 yyjson_mut_obj_add_val(d, caps, "tools", yyjson_mut_obj(d));
320 yyjson_mut_obj_add_val(d, result, "capabilities", caps);
321 yyjson_mut_obj_add_str(d, info, "name", "ascii-chat");
322 yyjson_mut_obj_add_str(d, info, "version", ASCII_CHAT_VERSION_FULL);
323 yyjson_mut_obj_add_val(d, result, "serverInfo", info);
324 const char *instructions =
326 ? "Render uploaded bytes or HTTP(S) media URLs as ASCII art. The "
327 "hosted server cannot access your webcam "
328 "or "
329 "local filesystem. Rendered files are returned as temporary "
330 "download links with UTC expiration "
331 "timestamps; "
332 "links expire after 30 minutes. Use output_format to select the "
333 "file format, snapshot-delay to set clip "
334 "duration, and options.audio=true to include source audio."
335 : "Render media as ASCII art. Uploaded bytes must be base64 "
336 "encoded by the client. snapshot-delay measures "
337 "capture duration after the first rendered frame; use seek for "
338 "media timestamps. output_path saves ASCII "
339 "art "
340 "as an image/video and never replaces an existing file.";
341 yyjson_mut_obj_add_str(d, result, "instructions", instructions);
342 return d;
343 }
344 if (!strcmp(name, "ping"))
345 return d;
346 if (!strcmp(name, "tools/list")) {
347 yyjson_mut_obj_add_val(d, result, "tools", mcp_tools_schema(d, &s->policy));
348 return d;
349 }
350 yyjson_mut_doc_free(d);
351 if (strcmp(name, "tools/call"))
352 return mcp_error(id, -32601, "Method not found");
353 const char *tool = yyjson_get_str(mcp_get(params, "name"));
354 if (tool &&
355 yyjson_get_len(mcp_get(params, "name")) == sizeof("device_list") - 1 &&
356 !strcmp(tool, "device_list")) {
357 if (s->policy.restricted)
358 return mcp_error(id, -32602, "Unknown tool");
359 ASCII_OTEL_ATTR_STRING("mcp.tool", "device_list");
360 return device_list_result(id, mcp_get(params, "arguments"));
361 }
362 const char *names[] = {"render_file", "render_url", "render_webcam",
363 "render_visualization"};
364 int kind = -1;
365 for (int i = 0; i < 4; ++i)
366 if (tool && strlen(tool) == yyjson_get_len(mcp_get(params, "name")) &&
367 !strcmp(tool, names[i]))
368 kind = i;
369 if (kind < 0 || (s->policy.restricted && kind == MCP_WEBCAM))
370 return mcp_error(id, -32602, "Unknown tool");
371 mcp_jobs_reap(s, false);
372 mcp_job_t *j = NULL;
373 for (unsigned i = 0; i < s->policy.max_jobs; ++i)
374 if (!s->jobs[i].renderer_job.started) {
375 j = &s->jobs[i];
376 break;
377 }
378 if (!j) {
379 char busy_message[128];
380 safe_snprintf(busy_message, sizeof(busy_message),
381 "Server busy; at most %u render%s may run concurrently",
382 s->policy.max_jobs, s->policy.max_jobs == 1 ? "" : "s");
383 return mcp_error(id, -32000, busy_message);
384 }
385 yyjson_val *arguments = mcp_get(params, "arguments");
386 yyjson_doc *empty = NULL;
387 if (!arguments) {
388 empty = yyjson_read("{}", 2, 0);
389 arguments = yyjson_doc_get_root(empty);
390 }
392 mcp_request_parse(&s->policy, (mcp_tool_t)kind, arguments, &j->request);
393 if (empty)
394 yyjson_doc_free(empty);
395 if (err != ASCIICHAT_OK) {
397 ASCII_OTEL_ATTR_STRING("error.type", "invalid_arguments");
400 SAFE_STRNCPY(fail.error,
401 HAS_ERRNO(&ctx) ? ctx.context_message
402 : "Invalid render request",
403 sizeof(fail.error));
405 return tool_result(id, &fail);
406 }
407 // Copy before returning to the transport, which owns and frees the input
408 // document.
409 size_t len;
410 char *copy = yyjson_write(message, 0, &len);
411 j->message = yyjson_read(copy, len, 0);
412 free(copy);
413 j->tool = (mcp_tool_t)kind;
415 j->server = s;
416 j->connection = connection;
417 if (session_id)
419 if (http_renderer_job_start(&j->renderer_job, "mcp-render", run_job, j) !=
420 ASCIICHAT_OK) {
422 yyjson_doc_free(j->message);
423 memset(j, 0, sizeof(*j));
424 return mcp_error(id, -32603, "Cannot create render worker");
425 }
426 *pending = true;
427 return NULL;
428}
#define SET_ERRNO(code,...)
#define HAS_ERRNO(context)
void atomic_store_bool(atomic_t *a, bool value)
Atomically store a boolean value.
bool atomic_load_bool(atomic_t *a)
Atomic pointer wrapper.
audio_visualization_source_t source
Definition fft.c:25
void audio_free_device_list(audio_device_info_t *devices)
Free device list allocated by audio_list_input_devices/audio_list_output_devices.
asciichat_error_t audio_list_input_devices(audio_device_info_t **out_devices, unsigned int *out_count)
List available audio input devices (microphones).
#define SAFE_STRNCPY(dst, src, size)
unsigned long long uint64_t
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
@ ASCIICHAT_OK
Definition error_codes.h:50
@ ERROR_FILE_OPERATION
#define log_error(...)
Log an ERROR message.
Definition log/log.h:604
#define log_info(...)
Log an INFO message.
Definition log/log.h:578
asciichat_error_t webcam_list_devices(webcam_device_info_t **out_devices, unsigned int *out_count)
Enumerate available webcam devices.
void webcam_free_device_list(webcam_device_info_t *devices)
Free device list returned by webcam_list_devices().
void mcp_http_wake(mcp_server_t *s)
Definition http.c:33
asciichat_error_t http_renderer_render_file(const char *path, const http_render_request_t *request, http_render_result_t *result, atomic_t *cancelled)
void http_render_request_init(http_render_request_t *request)
void http_renderer_job_join(http_renderer_job_t *job)
void http_render_result_destroy(http_render_result_t *result)
bool http_renderer_job_is_done(const http_renderer_job_t *job)
asciichat_error_t http_renderer_job_start(http_renderer_job_t *job, const char *name, http_renderer_job_fn execute, void *context)
void http_renderer_job_cancel(http_renderer_job_t *job)
void http_renderer_process(http_renderer_process_request_t *request, atomic_t *cancelled, http_renderer_process_result_t *result)
@ HTTP_RENDER_SOURCE_FILE
@ HTTP_RENDER_SOURCE_URL
@ HTTP_RENDER_OUTPUT_TEXT
void http_renderer_process_result_destroy(http_renderer_process_result_t *result)
🔊 Audio Capture and Playback Interface for ascii-chat
@ STATS_COUNTER_MCP_RENDER_FAILURES
void stats_counter_add(stats_scope_t *scope, stats_counter_id_t id, uint64_t amount)
void stats_duration_record(stats_scope_t *scope, stats_duration_id_t id, uint64_t elapsed_ns)
yyjson_mut_doc * mcp_error(yyjson_val *id, int code, const char *message)
void mcp_jobs_reap(mcp_server_t *s, bool all)
yyjson_mut_doc * mcp_dispatch(mcp_server_t *s, yyjson_doc *message, void *connection, const char *session_id, bool *pending)
void mcp_request_destroy(http_renderer_process_request_t *request)
Definition request.c:801
yyjson_mut_val * mcp_tools_schema(yyjson_mut_doc *doc, const mcp_policy_t *policy)
Definition request.c:173
mcp_tool_t
Definition mcp.h:35
@ MCP_WEBCAM
Definition mcp.h:35
struct mcp_server mcp_server_t
The useful part of mcp job is in server, message, response, request: together they describe what is p...
struct mcp_job mcp_job_t
When code needs to work with mcp policy, it keeps hosted, restricted, address, address6 here instead ...
asciichat_error_t mcp_request_parse(const mcp_policy_t *policy, mcp_tool_t tool, yyjson_val *arguments, http_renderer_process_request_t *out)
Definition request.c:483
void mcp_stdio_send(mcp_server_t *server, yyjson_mut_doc *response)
Definition stdio.c:34
gotel_context_t ascii_otel_context(void)
Definition otel.c:870
void ascii_otel_error(const char *message)
Definition otel.c:965
#define ASCII_OTEL_SCOPE(id)
Definition otel.h:102
#define ASCII_OTEL_SCOPE_PARENT(id, parent)
Definition otel.h:98
#define ASCII_OTEL_ATTR_INT(key, value)
Definition otel.h:94
#define ASCII_OTEL_ATTR_STRING(key, value)
Definition otel.h:92
static bool size_t index
Definition queries.h:10
stats_scope_t * stats_runtime_scope(void)
Definition runtime.c:88
uint8_t session_id[SESSION_ID_SIZE]
🔤 String Manipulation and Shell Escaping Utilities
Atomic value wrapper for integral/boolean types.
Definition atomic.h:80
Audio device information structure.
int index
PortAudio device index.
http_render_source_t source
http_render_options_t options
char path[PLATFORM_MAX_PATH_LENGTH]
http_render_source_type_t type
char url[OPTIONS_BUFF_SIZE]
http_render_output_type_t output_type
http_render_options_t options
char source_path[PLATFORM_MAX_PATH_LENGTH]
char source_url[OPTIONS_BUFF_SIZE]
char output_path[PLATFORM_MAX_PATH_LENGTH]
http_render_frame_t * frames
yyjson_doc * message
Definition mcp.h:66
mcp_tool_t tool
Definition mcp.h:69
void * connection
Definition mcp.h:72
gotel_context_t telemetry_parent
Definition mcp.h:70
yyjson_mut_doc * response
Definition mcp.h:67
http_renderer_job_t renderer_job
Definition mcp.h:71
char session_id[32+1]
Definition mcp.h:73
struct mcp_server * server
Definition mcp.h:65
http_renderer_process_request_t request
Definition mcp.h:68
unsigned max_jobs
Definition mcp.h:42
bool restricted
Definition mcp.h:38
bool hosted
Definition mcp.h:37
bool initialized
Definition mcp.h:92
mcp_job_t * jobs
Definition mcp.h:88
mcp_policy_t policy
Definition mcp.h:87
Webcam device information structure.
Definition webcam.h:93
unsigned int index
Device index (use with webcam_init_context).
Definition webcam.h:94
⏱️ High-precision timing utilities using sokol_time.h and uthash