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

Function call_snippet

tests/test_mcp.c:19334–19351  ·  view source on GitHub ↗

Call get_code_snippet and extract inner text content. * Caller must free returned string. */

Source from the content-addressed store, hash-verified

19332/* Call get_code_snippet and extract inner text content.
19333 * Caller must free returned string. */
19334static char *call_snippet(cbm_mcp_server_t *srv, const char *args_json) {
19335 yyjson_doc *input_doc = yyjson_read(args_json, strlen(args_json), 0);
19336 if (!input_doc) {
19337 return NULL;
19338 }
19339 yyjson_mut_doc *request_doc = yyjson_mut_doc_new(NULL);
19340 yyjson_mut_val *request = yyjson_val_mut_copy(request_doc, yyjson_doc_get_root(input_doc));
19341 yyjson_mut_doc_set_root(request_doc, request);
19342 yyjson_mut_obj_add_str(request_doc, request, "format", "json");
19343 char *json_args = yyjson_mut_write(request_doc, 0, NULL);
19344 yyjson_mut_doc_free(request_doc);
19345 yyjson_doc_free(input_doc);
19346 char *raw = cbm_mcp_handle_tool(srv, "get_code_snippet", json_args);
19347 free(json_args);
19348 char *text = extract_text_content(raw);
19349 free(raw);
19350 return text;
19351}
19352
19353static bool is_valid_json_response(const char *json) {
19354 if (!json) {

Callers 1

test_mcp.cFile · 0.85

Calls 2

cbm_mcp_handle_toolFunction · 0.85
extract_text_contentFunction · 0.85

Tested by

no test coverage detected