MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_daemon_application_client_tool

Function cbm_daemon_application_client_tool

src/daemon/application.c:4004–4026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4002}
4003
4004cbm_daemon_runtime_application_status_t cbm_daemon_application_client_tool(
4005 cbm_daemon_runtime_client_t *client, const char *tool_name, const char *args_json,
4006 uint8_t **response_out, uint32_t *response_length_out, uint32_t timeout_ms) {
4007 if (!client || !tool_name || !tool_name[0] || !args_json || !args_json[0]) {
4008 return CBM_DAEMON_RUNTIME_APPLICATION_REJECTED;
4009 }
4010 size_t tool_length = strlen(tool_name);
4011 size_t args_length = strlen(args_json);
4012 uint64_t total = (uint64_t)APPLICATION_TOOL_HEADER_SIZE + tool_length + args_length;
4013 if (tool_length > UINT32_MAX || total > CBM_DAEMON_RUNTIME_APPLICATION_PAYLOAD_MAX) {
4014 return CBM_DAEMON_RUNTIME_APPLICATION_REJECTED;
4015 }
4016 uint8_t *request = malloc((size_t)total);
4017 if (!request) {
4018 return CBM_DAEMON_RUNTIME_APPLICATION_TRANSPORT_ERROR;
4019 }
4020 request[0] = CBM_DAEMON_APPLICATION_REQUEST_TOOL;
4021 application_put_u32(request + 1, (uint32_t)tool_length);
4022 memcpy(request + APPLICATION_TOOL_HEADER_SIZE, tool_name, tool_length);
4023 memcpy(request + APPLICATION_TOOL_HEADER_SIZE + tool_length, args_json, args_length);
4024 return application_client_exchange(client, request, (uint32_t)total, response_out,
4025 response_length_out, timeout_ms);
4026}
4027
4028cbm_daemon_runtime_application_status_t cbm_daemon_application_client_hook_augment(
4029 cbm_daemon_runtime_client_t *client, const char *input_json, uint8_t **response_out,

Calls 2

application_put_u32Function · 0.85