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

Function append_codex_profile

src/cli/agent_profiles.c:463–499  ·  view source on GitHub ↗

Codex deserializes role files standalone: a server table without command/url * is rejected as "invalid transport" and the whole role is dropped, so direct * profiles must declare the transport. rc1_transportless reproduces the * v0.9.1-rc.1 rendering so installs can migrate those files. */

Source from the content-addressed store, hash-verified

461 * profiles must declare the transport. rc1_transportless reproduces the
462 * v0.9.1-rc.1 rendering so installs can migrate those files. */
463static bool append_codex_profile(profile_buffer_t *buffer, cbm_graph_tier_t tier,
464 cbm_graph_access_t access, const char *binary_path,
465 const char *prompt, bool rc1_transportless) {
466 if (!profile_buffer_append(buffer, "name = \"") ||
467 !profile_buffer_append(buffer, cbm_graph_tier_slug(tier)) ||
468 !profile_buffer_append(buffer, "\"\ndescription = \"") ||
469 !profile_buffer_append(buffer, profile_description(tier, access)) ||
470 !profile_buffer_append(buffer, "\"\nsandbox_mode = \"read-only\"\ndeveloper_instructions = "
471 "\"\"\"\n") ||
472 !profile_buffer_append(buffer, prompt) || !profile_buffer_append(buffer, "\"\"\"\n")) {
473 return false;
474 }
475 if (access != CBM_GRAPH_ACCESS_DIRECT) {
476 return true;
477 }
478 if (!profile_buffer_append(buffer, "\n[mcp_servers.codebase-memory-mcp]\n")) {
479 return false;
480 }
481 if (!rc1_transportless) {
482 char escaped_binary[8192];
483 if (!binary_path || !binary_path[0] ||
484 cbm_toml_escape_basic_string(binary_path, escaped_binary, sizeof(escaped_binary)) !=
485 0) {
486 return false;
487 }
488 if (!profile_buffer_append(buffer, "command = \"") ||
489 !profile_buffer_append(buffer, escaped_binary) ||
490 !profile_buffer_append(buffer, "\"\nargs = [\"--tool-profile=") ||
491 !profile_buffer_append(buffer, tier_server_profile(tier)) ||
492 !profile_buffer_append(buffer, "\"]\n")) {
493 return false;
494 }
495 }
496 return profile_buffer_append(buffer, "enabled_tools = [") &&
497 append_toml_mcp_tools(buffer, CBM_GRAPH_DIALECT_CODEX, tier, false) &&
498 profile_buffer_append(buffer, "]\n");
499}
500
501/* before_tool_search reproduces the v0.10.8 rendering: #1933 (v0.11.0) added
502 * the tool_search / tool_search_regex permissions, and install/uninstall

Callers 2

render_profile_textFunction · 0.85
render_released_profileFunction · 0.85

Calls 6

profile_buffer_appendFunction · 0.85
cbm_graph_tier_slugFunction · 0.85
profile_descriptionFunction · 0.85
tier_server_profileFunction · 0.85
append_toml_mcp_toolsFunction · 0.85

Tested by

no test coverage detected