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

Function mcp_string_arg_buf

src/mcp/mcp.c:1567–1580  ·  view source on GitHub ↗

String argument `key` copied into `buf` (truncated to fit): buf, or NULL * when absent or empty. Nothing to free. */

Source from the content-addressed store, hash-verified

1565/* String argument `key` copied into `buf` (truncated to fit): buf, or NULL
1566 * when absent or empty. Nothing to free. */
1567static const char *mcp_string_arg_buf(const char *args_json, const char *key, char *buf,
1568 size_t buf_sz) {
1569 buf[0] = '\0';
1570 yyjson_doc *doc = yyjson_read(args_json, strlen(args_json), 0);
1571 if (!doc) {
1572 return NULL;
1573 }
1574 yyjson_val *val = yyjson_obj_get(yyjson_doc_get_root(doc), key);
1575 if (val && yyjson_is_str(val)) {
1576 snprintf(buf, buf_sz, "%s", yyjson_get_str(val));
1577 }
1578 yyjson_doc_free(doc);
1579 return buf[0] ? buf : NULL;
1580}
1581
1582static char *canonicalize_repo_path_if_exists(char *repo_path) {
1583 if (!repo_path) {

Callers 1

handle_search_graphFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected