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

Function append_codex_profile

src/cli/agent_profiles.c:459–495  ·  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

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

Callers 2

render_profile_textFunction · 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