Skip to content

mcp: disable codedb_bundle by default — schema footgun keeps surfacing in OpenAI clients #443

@justrach

Description

@justrach

Problem

The codedb_bundle tool has been a footgun across multiple stages and the empty-args failure mode keeps re-surfacing on OpenAI clients:

Even with all of the above, OpenAI/forgecode/codex clients still emit {"tool":"codedb_*","arguments":{}} because the default schema's arguments field is a bare {type:"object"} with no inner shape, and the discriminated oneOf is opt-in only (since OpenAI strict-mode rejects oneOf).

The right structural fix is reworking the schema to bind sub-tool arguments inline (no arguments wrapper). Until that lands, disable codedb_bundle entirely so OpenAI clients stop hitting the empty-args error path.

The dispatcher-side handler stays (so any client with a cached schema doesn't crash on call), but the runtime tools/list response no longer advertises it. CODEDB_BUNDLE_ENABLED=1 re-enables advertisement for callers that want to opt back in.

Failing Test

test "issue-443: codedb_bundle is omitted from default tools/list response" {
    const response = try mcp_mod.buildToolsListResponse(testing.allocator, .{
        .bundle_enabled = false,
        .discriminated_opt_in = false,
    });
    defer testing.allocator.free(response);
    const parsed = try std.json.parseFromSlice(std.json.Value, testing.allocator, response, .{});
    defer parsed.deinit();
    const tools = parsed.value.object.get("tools").?.array;
    for (tools.items) |t| {
        try testing.expect(!std.mem.eql(u8, t.object.get("name").?.string, "codedb_bundle"));
    }
}

Plus a paired test asserting bundle_enabled = true re-includes codedb_bundle. Both committed on `issue-443-failing-test`.

Expected

tools/list (the runtime response served from run()) does not advertise codedb_bundle by default. Setting CODEDB_BUNDLE_ENABLED=1 re-includes it.

Fix

Extract the inline tools_list builder in `run()` into `buildToolsListResponse(alloc, opts)` with a `bundle_enabled` flag (default false). When false, parse `tools_list`, drop the `codedb_bundle` entry, restringify. When true, behave as today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p2Medium priority

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions