Summary
The official anthropic Ruby gem's Messages and Beta Messages APIs support two significant, currently-documented fields that this SDK's instrumentation silently drops from span metadata: container (code execution tool sandbox reuse) and mcp_servers (the MCP connector, which lets Claude call tools on remote MCP servers directly during generation). Both directly affect what happens during model execution — which tools were actually available/reused, which sandbox state persisted across turns — yet neither appears in any span this SDK produces.
What is missing
-
mcp_servers (request param, beta Messages API): configures remote MCP servers Claude can call tools on mid-generation. Official Ruby example from Anthropic's own docs:
client.beta.messages.create(
model: "claude-opus-4-8",
max_tokens: 1000,
messages: [...],
mcp_servers: [{type: "url", url: "...", name: "example-mcp", authorization_token: "..."}],
tools: [{type: "mcp_toolset", mcp_server_name: "example-mcp"}],
betas: ["mcp-client-2025-11-20"]
)
Also usable inside Message Batches requests.
-
container (request param + response field, both stable and beta Messages APIs): identifies/reuses the sandboxed code-execution container across requests so state (e.g. Python variable bindings) persists. Documented on Anthropic::Models::Message in the official Ruby SDK docs as "Information about the container used in the request (for the code execution tool)."
Neither field is in METADATA_FIELDS (lib/braintrust/contrib/anthropic/instrumentation/messages.rb:25-28) or BETA_METADATA_FIELDS/METADATA_FIELDS (lib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb:29-37), and finalize_metadata/set_output in both files never read response.container. So a user running a code-execution or MCP-connector workflow through this SDK gets a Braintrust trace with no record of which container was reused or which MCP servers/tools were actually wired up — a debugging-critical omission for exactly the kind of agentic tool-execution traces Braintrust is meant to surface.
Braintrust docs status
not_found for Ruby — https://www.braintrust.dev/docs/integrations/ai-providers/anthropic does not mention container or mcp_servers anywhere in the Ruby-specific section. Notably, the Go section of the same page explicitly lists both as captured request parameters ("each span captures ... container, mcp_servers ..."), showing Braintrust already treats these as first-class fields for another language SDK — Ruby is the outlier.
Upstream sources
Local repo files inspected
lib/braintrust/contrib/anthropic/instrumentation/messages.rb — METADATA_FIELDS (lines 25-28) and finalize_metadata (lines 141-146) omit container; no mcp_servers handling anywhere
lib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb — METADATA_FIELDS/BETA_METADATA_FIELDS (lines 29-37) and capture_beta_fields (lines 146-166) capture only betas and output_format; no container or mcp_servers
lib/braintrust/contrib/anthropic/instrumentation/common.rb — token usage parser only; no incidental capture of container/mcp_servers
- Grep for
container, mcp_servers, mcp_server across lib/braintrust/ returns zero relevant matches (one unrelated hit in lib/braintrust/server/services/list_service.rb)
Summary
The official
anthropicRuby gem's Messages and Beta Messages APIs support two significant, currently-documented fields that this SDK's instrumentation silently drops from span metadata:container(code execution tool sandbox reuse) andmcp_servers(the MCP connector, which lets Claude call tools on remote MCP servers directly during generation). Both directly affect what happens during model execution — which tools were actually available/reused, which sandbox state persisted across turns — yet neither appears in any span this SDK produces.What is missing
mcp_servers(request param, beta Messages API): configures remote MCP servers Claude can call tools on mid-generation. Official Ruby example from Anthropic's own docs:Also usable inside Message Batches requests.
container(request param + response field, both stable and beta Messages APIs): identifies/reuses the sandboxed code-execution container across requests so state (e.g. Python variable bindings) persists. Documented onAnthropic::Models::Messagein the official Ruby SDK docs as "Information about the container used in the request (for the code execution tool)."Neither field is in
METADATA_FIELDS(lib/braintrust/contrib/anthropic/instrumentation/messages.rb:25-28) orBETA_METADATA_FIELDS/METADATA_FIELDS(lib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb:29-37), andfinalize_metadata/set_outputin both files never readresponse.container. So a user running a code-execution or MCP-connector workflow through this SDK gets a Braintrust trace with no record of which container was reused or which MCP servers/tools were actually wired up — a debugging-critical omission for exactly the kind of agentic tool-execution traces Braintrust is meant to surface.Braintrust docs status
not_foundfor Ruby — https://www.braintrust.dev/docs/integrations/ai-providers/anthropic does not mentioncontainerormcp_serversanywhere in the Ruby-specific section. Notably, the Go section of the same page explicitly lists both as captured request parameters ("each span captures ...container,mcp_servers..."), showing Braintrust already treats these as first-class fields for another language SDK — Ruby is the outlier.Upstream sources
Anthropic::Models::Message#container(official Ruby SDK, main branch docs): https://preview.rubydoc.info/github/anthropics/anthropic-sdk-ruby/Anthropic/Models/MessageLocal repo files inspected
lib/braintrust/contrib/anthropic/instrumentation/messages.rb—METADATA_FIELDS(lines 25-28) andfinalize_metadata(lines 141-146) omitcontainer; nomcp_servershandling anywherelib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb—METADATA_FIELDS/BETA_METADATA_FIELDS(lines 29-37) andcapture_beta_fields(lines 146-166) capture onlybetasandoutput_format; nocontainerormcp_serverslib/braintrust/contrib/anthropic/instrumentation/common.rb— token usage parser only; no incidental capture of container/mcp_serverscontainer,mcp_servers,mcp_serveracrosslib/braintrust/returns zero relevant matches (one unrelated hit inlib/braintrust/server/services/list_service.rb)