Skip to content

feat(contrib/mark3labs/mcp-go): support per-request intent capture#4944

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
jb/mcp-conditional-intent-capture
Jul 3, 2026
Merged

feat(contrib/mark3labs/mcp-go): support per-request intent capture#4944
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
jb/mcp-conditional-intent-capture

Conversation

@jboolean

@jboolean jboolean commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

One of the reasons we make a clone of this mcp-go contrib in dd-source was for feature flagging. Originally this was supposed to be temporary, but it continues to be used for org opt-outs and compliance. So in order to remove the clone, we now need to build this per-request optionality as a feature of the SDK.

What this enables in dd-source

The internal dd-source copy of this contrib ships its own isIntentCaptureEnabled(ctx) predicate in mcp-go/flags.go and calls it directly inside the hook and middleware (no public knob to override the static boolean). With this PR, dd-source can pass that same predicate through TracingConfig.IntentCaptureEnabledFunc and delete the local fork of the hook/middleware.

Test plan

  • TestIntentCaptureEnabledFunc — same config, two contexts: predicate false skips schema injection AND leaves the telemetry argument intact in the handler args; predicate true injects and strips.
  • TestIntentCaptureEnabledFuncOverridesBool — when both the static bool and the predicate are set, the predicate wins.
  • All existing intent-capture and tracing tests still pass.

Stacked on #4943.


Parallel port in the modelcontextprotocol/go-sdk contrib: #4950

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Jun 24, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 92.59%
Overall Coverage: 62.79%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2e459f6 | Docs | Datadog PR Page | Give us feedback!

@pr-commenter

pr-commenter Bot commented Jun 24, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-01 16:47:14

Comparing candidate commit 2e459f6 in PR branch jb/mcp-conditional-intent-capture with baseline commit f6787f2 in branch jb/mcp-tool-span-session-id.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 321 metrics, 2 unstable metrics, 1 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

Known flaky benchmarks without significant changes:

  • scenario:BenchmarkOTLPTraceWriterFlush

@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch from 4304847 to d0520e7 Compare June 24, 2026 14:43
@jboolean jboolean force-pushed the jb/mcp-tool-span-session-id branch from c008d76 to 0dbe777 Compare June 24, 2026 14:43
@jboolean jboolean requested a review from rgwood-dd June 24, 2026 14:46
@jboolean jboolean force-pushed the jb/mcp-tool-span-session-id branch from 0dbe777 to e079d34 Compare June 24, 2026 15:09
@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch from d0520e7 to 685d0fd Compare June 24, 2026 15:09
@jboolean jboolean marked this pull request as ready for review June 24, 2026 15:21
@jboolean jboolean requested review from a team as code owners June 24, 2026 15:22
@jboolean jboolean requested review from rarguelloF and removed request for a team June 24, 2026 15:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 685d0fd9e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +26 to +34
// IntentCaptureEnabledFunc is a per-request predicate that gates intent capture
// at runtime. When non-nil, the intent-capture hook and middleware are registered
// and consult the predicate on every tools/list and tools/call: if it returns
// false, that request behaves as if intent capture were disabled (no schema
// injection, no telemetry stripping, no intent annotation).
//
// If both IntentCaptureEnabled and IntentCaptureEnabledFunc are set, the
// predicate wins. If both are unset, intent capture is disabled.
IntentCaptureEnabledFunc func(ctx context.Context) bool

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the new intent-capture predicate

This adds a new public customization path for the tracer, but the commit does not update the required docs. The root AGENTS.md says CONTRIBUTING.md must be updated for significant features, including a new method of interacting with or customizing the tracer; the contrib README still only documents IntentCaptureEnabled, so users won't discover the per-request predicate or the bool-vs-predicate precedence.

Useful? React with 👍 / 👎.

@jboolean jboolean Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same response as on #4945: this stack documents new TracingConfig knobs via GoDoc on the field, matching how IntentCaptureEnabled and Hooks are documented today. CONTRIBUTING.md has no MCP section to extend. [claude]

@jboolean jboolean force-pushed the jb/mcp-tool-span-session-id branch from e079d34 to f0a5ee7 Compare June 24, 2026 15:28
@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch from 685d0fd to 7e486c3 Compare June 24, 2026 15:28
@jboolean jboolean force-pushed the jb/mcp-tool-span-session-id branch from f0a5ee7 to 5142cf6 Compare June 24, 2026 16:48
@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch from 7e486c3 to 7a44561 Compare June 24, 2026 16:48
@jboolean jboolean force-pushed the jb/mcp-tool-span-session-id branch from 5142cf6 to 9036f6d Compare June 24, 2026 17:29
@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch from 7a44561 to f97103f Compare June 24, 2026 17:29
@jboolean jboolean requested a review from sabrenner June 25, 2026 14:55
@jboolean jboolean force-pushed the jb/mcp-tool-span-session-id branch from 9036f6d to f6787f2 Compare June 30, 2026 20:30
@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch from f97103f to a7f854e Compare June 30, 2026 20:30
@github-actions

Copy link
Copy Markdown
Contributor

Config Audit

PACKAGE: contrib/confluentinc/confluent-kafka-go/kafkatrace
  STATUS      CONFIG                            CALL_SITES
  UNMIGRATED  DD_TRACE_KAFKA_ANALYTICS_ENABLED  1

PACKAGE: ddtrace/opentelemetry/log
  STATUS      CONFIG                            CALL_SITES
  STILL_READ  DD_AGENT_HOST                     2
  STILL_READ  DD_ENV                            1
  STILL_READ  DD_SERVICE                        1
  STILL_READ  DD_TAGS                           1
  STILL_READ  DD_TRACE_AGENT_URL                2
  STILL_READ  DD_TRACE_REPORT_HOSTNAME          1
  STILL_READ  DD_VERSION                        1
  UNMIGRATED  DD_HOSTNAME                       1
  UNMIGRATED  OTEL_BLRP_EXPORT_TIMEOUT          1
  UNMIGRATED  OTEL_BLRP_MAX_EXPORT_BATCH_SIZE   1
  UNMIGRATED  OTEL_BLRP_MAX_QUEUE_SIZE          1
  UNMIGRATED  OTEL_BLRP_SCHEDULE_DELAY          1
  UNMIGRATED  OTEL_EXPORTER_OTLP_ENDPOINT       4
  UNMIGRATED  OTEL_EXPORTER_OTLP_HEADERS        2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_ENDPOINT  4
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_HEADERS   2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_PROTOCOL  2
  UNMIGRATED  OTEL_EXPORTER_OTLP_LOGS_TIMEOUT   1
  UNMIGRATED  OTEL_EXPORTER_OTLP_PROTOCOL       2
  UNMIGRATED  OTEL_EXPORTER_OTLP_TIMEOUT        1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES          1

PACKAGE: ddtrace/opentelemetry/metric
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_AGENT_HOST                                      2
  STILL_READ  DD_ENV                                             1
  STILL_READ  DD_METRICS_OTEL_ENABLED                            1
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TAGS                                            1
  STILL_READ  DD_TRACE_AGENT_URL                                 2
  STILL_READ  DD_TRACE_REPORT_HOSTNAME                           1
  STILL_READ  DD_VERSION                                         1
  STILL_READ  OTEL_METRICS_EXPORTER                              1
  UNMIGRATED  DD_HOSTNAME                                        1
  UNMIGRATED  OTEL_EXPORTER_OTLP_ENDPOINT                        2
  UNMIGRATED  OTEL_EXPORTER_OTLP_HEADERS                         1
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_ENDPOINT                2
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_HEADERS                 1
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_PROTOCOL                2
  UNMIGRATED  OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE  1
  UNMIGRATED  OTEL_EXPORTER_OTLP_PROTOCOL                        2
  UNMIGRATED  OTEL_EXPORTER_OTLP_TIMEOUT                         1
  UNMIGRATED  OTEL_RESOURCE_ATTRIBUTES                           1
  UNMIGRATED  OTEL_SERVICE_NAME                                  1

PACKAGE: ddtrace/tracer
  STATUS      CONFIG                                     CALL_SITES
  STILL_READ  DD_API_KEY                                 1
  UNMIGRATED  DD_APM_TRACING_ENABLED                     1
  UNMIGRATED  DD_APP_KEY                                 1
  UNMIGRATED  DD_CIVISIBILITY_AGENTLESS_URL              1
  UNMIGRATED  DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED  1
  UNMIGRATED  DD_LLMOBS_AGENTLESS_ENABLED                1
  UNMIGRATED  DD_LLMOBS_ENABLED                          1
  UNMIGRATED  DD_LLMOBS_ML_APP                           1
  UNMIGRATED  DD_LLMOBS_PROJECT_NAME                     1
  UNMIGRATED  DD_SITE                                    2
  UNMIGRATED  DD_TRACER_EXPERIMENTAL_SPAN_POOL_ENABLED   1
  UNMIGRATED  DD_TRACE_128_BIT_TRACEID_LOGGING_ENABLED   1
  UNMIGRATED  DD_TRACE_DEBUG_SEELOG_WORKAROUND           1
  UNMIGRATED  DD_TRACE_ENABLED                           1
  UNMIGRATED  DD_TRACE_PROPAGATION_BEHAVIOR_EXTRACT      1
  UNMIGRATED  DD_TRACE_PROPAGATION_EXTRACT_FIRST         1
  UNMIGRATED  DD_TRACE_PROPAGATION_STYLE_EXTRACT         1
  UNMIGRATED  DD_TRACE_PROPAGATION_STYLE_INJECT          1
  UNMIGRATED  OTEL_TRACES_SAMPLER_ARG                    1

PACKAGE: instrumentation
  STATUS      CONFIG                                       CALL_SITES
  STILL_READ  DD_DATA_STREAMS_ENABLED                      1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_ENABLED  1

PACKAGE: instrumentation/graphql
  STATUS      CONFIG                             CALL_SITES
  UNMIGRATED  DD_TRACE_GRAPHQL_ERROR_EXTENSIONS  1

PACKAGE: instrumentation/httptrace
  STATUS      CONFIG                                                 CALL_SITES
  UNMIGRATED  DD_TRACE_BAGGAGE_TAG_KEYS                              1
  UNMIGRATED  DD_TRACE_CLIENT_IP_ENABLED                             1
  UNMIGRATED  DD_TRACE_HTTP_SERVER_ERROR_STATUSES                    1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST               1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_CLIENT        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_ALLOWLIST_SERVER        1
  UNMIGRATED  DD_TRACE_HTTP_URL_QUERY_STRING_DISABLED                1
  UNMIGRATED  DD_TRACE_INFERRED_PROXY_SERVICES_ENABLED               1
  UNMIGRATED  DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP               2
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT  1
  UNMIGRATED  DD_TRACE_RESOURCE_RENAMING_ENABLED                     1

PACKAGE: instrumentation/internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TRACE_SPAN_ATTRIBUTE_SCHEMA                     1
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal
  STATUS      CONFIG                         CALL_SITES
  STILL_READ  DD_AGENT_HOST                  1
  STILL_READ  DD_TAGS                        1
  STILL_READ  DD_TRACE_AGENT_PORT            1
  STILL_READ  DD_TRACE_AGENT_URL             1
  UNMIGRATED  DD_EXTERNAL_ENV                1
  UNMIGRATED  DD_GIT_COMMIT_SHA              1
  UNMIGRATED  DD_GIT_REPOSITORY_URL          1
  UNMIGRATED  DD_TRACE_GIT_METADATA_ENABLED  1

PACKAGE: internal/appsec
  STATUS      CONFIG           CALL_SITES
  UNMIGRATED  DD_APPSEC_RULES  1

PACKAGE: internal/appsec/config
  STATUS      CONFIG                                                CALL_SITES
  UNMIGRATED  DD_API_SECURITY_DOWNSTREAM_BODY_ANALYSIS_SAMPLE_RATE  1
  UNMIGRATED  DD_API_SECURITY_ENABLED                               1
  UNMIGRATED  DD_API_SECURITY_MAX_DOWNSTREAM_REQUEST_BODY_ANALYSIS  1
  UNMIGRATED  DD_API_SECURITY_PROXY_SAMPLE_RATE                     1
  UNMIGRATED  DD_API_SECURITY_REQUEST_SAMPLE_RATE                   1
  UNMIGRATED  DD_API_SECURITY_SAMPLE_DELAY                          1
  UNMIGRATED  DD_APM_TRACING_ENABLED                                1
  UNMIGRATED  DD_APPSEC_ENABLED                                     1
  UNMIGRATED  DD_APPSEC_RASP_ENABLED                                1
  UNMIGRATED  DD_APPSEC_RULES                                       1
  UNMIGRATED  DD_APPSEC_SCA_ENABLED                                 1
  UNMIGRATED  DD_APPSEC_TRACE_RATE_LIMIT                            1
  UNMIGRATED  DD_APPSEC_WAF_TIMEOUT                                 1

PACKAGE: internal/appsec/listener/httpsec
  STATUS      CONFIG                     CALL_SITES
  UNMIGRATED  DD_TRACE_CLIENT_IP_HEADER  1

PACKAGE: internal/bazel
  STATUS      CONFIG                                  CALL_SITES
  UNMIGRATED  DD_TEST_OPTIMIZATION_MANIFEST_FILE      1
  UNMIGRATED  DD_TEST_OPTIMIZATION_PAYLOADS_IN_FILES  1

PACKAGE: internal/civisibility/envconfig
  STATUS      CONFIG                   CALL_SITES
  STILL_READ  DD_CIVISIBILITY_ENABLED  1

PACKAGE: internal/civisibility/integrations
  STATUS      CONFIG                                               CALL_SITES
  STILL_READ  DD_SERVICE                                           1
  STILL_READ  DD_TRACE_DEBUG                                       1
  UNMIGRATED  DD_CIVISIBILITY_CODE_COVERAGE_REPORT_UPLOAD_ENABLED  1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_COUNT                    1
  UNMIGRATED  DD_CIVISIBILITY_FLAKY_RETRY_ENABLED                  1
  UNMIGRATED  DD_CIVISIBILITY_GIT_UPLOAD_ENABLED                   1
  UNMIGRATED  DD_CIVISIBILITY_IMPACTED_TESTS_DETECTION_ENABLED     1
  UNMIGRATED  DD_CIVISIBILITY_SUBTEST_FEATURES_ENABLED             1
  UNMIGRATED  DD_CIVISIBILITY_TOTAL_FLAKY_RETRY_COUNT              1
  UNMIGRATED  DD_TEST_MANAGEMENT_ATTEMPT_TO_FIX_RETRIES            1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                           1

PACKAGE: internal/civisibility/integrations/gotesting
  STATUS      CONFIG                                                           CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_INTERNAL_PARALLEL_EARLY_FLAKE_DETECTION_ENABLED  1
  UNMIGRATED  DD_TEST_MANAGEMENT_ENABLED                                       1

PACKAGE: internal/civisibility/integrations/logs
  STATUS      CONFIG                        CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_LOGS_ENABLED  1

PACKAGE: internal/civisibility/utils
  STATUS      CONFIG                              CALL_SITES
  STILL_READ  DD_SERVICE                          1
  UNMIGRATED  DD_ACTION_EXECUTION_ID              1
  UNMIGRATED  DD_PIPELINE_EXECUTION_ID            1
  UNMIGRATED  DD_TEST_OPTIMIZATION_ENV_DATA_FILE  1
  UNMIGRATED  DD_TEST_SESSION_NAME                1

PACKAGE: internal/civisibility/utils/net
  STATUS      CONFIG                             CALL_SITES
  STILL_READ  DD_API_KEY                         1
  STILL_READ  DD_CIVISIBILITY_AGENTLESS_ENABLED  1
  STILL_READ  DD_ENV                             1
  STILL_READ  DD_SERVICE                         1
  STILL_READ  DD_TAGS                            1
  STILL_READ  DD_VERSION                         1
  UNMIGRATED  DD_CIVISIBILITY_AGENTLESS_URL      1
  UNMIGRATED  DD_SITE                            1

PACKAGE: internal/civisibility/utils/telemetry
  STATUS      CONFIG                                         CALL_SITES
  UNMIGRATED  DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER  1

PACKAGE: internal/globalconfig
  STATUS      CONFIG                           CALL_SITES
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_ID    1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TIME  1
  UNMIGRATED  DD_INSTRUMENTATION_INSTALL_TYPE  1

PACKAGE: internal/hostname
  STATUS      CONFIG       CALL_SITES
  UNMIGRATED  DD_HOSTNAME  1

PACKAGE: internal/namingschema
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_SERVICE                                         1
  STILL_READ  DD_TRACE_SPAN_ATTRIBUTE_SCHEMA                     1
  UNMIGRATED  DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED  1

PACKAGE: internal/processtags
  STATUS      CONFIG                                          CALL_SITES
  UNMIGRATED  DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED  1

PACKAGE: internal/remoteconfig
  STATUS      CONFIG                                  CALL_SITES
  STILL_READ  DD_ENV                                  1
  UNMIGRATED  DD_RC_TUF_ROOT                          1
  UNMIGRATED  DD_REMOTE_CONFIGURATION_ENABLED         1
  UNMIGRATED  DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS  1

PACKAGE: internal/stacktrace
  STATUS      CONFIG                           CALL_SITES
  UNMIGRATED  DD_APPSEC_MAX_STACK_TRACE_DEPTH  1
  UNMIGRATED  DD_APPSEC_STACK_TRACE_ENABLED    1

PACKAGE: internal/telemetry
  STATUS      CONFIG                                             CALL_SITES
  STILL_READ  DD_API_KEY                                         1
  UNMIGRATED  DD_API_SECURITY_ENDPOINT_COLLECTION_MESSAGE_LIMIT  1
  UNMIGRATED  DD_INSTRUMENTATION_TELEMETRY_ENABLED               1
  UNMIGRATED  DD_SITE                                            1
  UNMIGRATED  DD_TELEMETRY_DEBUG                                 1
  UNMIGRATED  DD_TELEMETRY_DEPENDENCY_COLLECTION_ENABLED         1
  UNMIGRATED  DD_TELEMETRY_EXTENDED_HEARTBEAT_INTERVAL           1
  UNMIGRATED  DD_TELEMETRY_HEARTBEAT_INTERVAL                    1
  UNMIGRATED  DD_TELEMETRY_LOG_COLLECTION_ENABLED                1
  UNMIGRATED  DD_TELEMETRY_METRICS_ENABLED                       1

PACKAGE: openfeature
  STATUS      CONFIG                                     CALL_SITES
  STILL_READ  DD_ENV                                     2
  STILL_READ  DD_SERVICE                                 2
  STILL_READ  DD_VERSION                                 2
  UNMIGRATED  DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED  1
  UNMIGRATED  DD_FLAGGING_EVALUATION_COUNTS_ENABLED      1

PACKAGE: profiler
  STATUS      CONFIG                                    CALL_SITES
  STILL_READ  DD_API_KEY                                1
  STILL_READ  DD_ENV                                    1
  STILL_READ  DD_SERVICE                                1
  STILL_READ  DD_TAGS                                   1
  STILL_READ  DD_TRACE_STARTUP_LOGS                     1
  STILL_READ  DD_VERSION                                1
  UNMIGRATED  DD_PROFILING_AGENTLESS                    1
  UNMIGRATED  DD_PROFILING_DEBUG_COMPRESSION_SETTINGS   1
  UNMIGRATED  DD_PROFILING_DELTA                        1
  UNMIGRATED  DD_PROFILING_ENABLED                      3
  UNMIGRATED  DD_PROFILING_ENDPOINT_COUNT_ENABLED       1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_ENABLED      1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_LIMIT_BYTES  1
  UNMIGRATED  DD_PROFILING_EXECUTION_TRACE_PERIOD       1
  UNMIGRATED  DD_PROFILING_FLUSH_ON_EXIT                1
  UNMIGRATED  DD_PROFILING_OUTPUT_DIR                   1
  UNMIGRATED  DD_PROFILING_UPLOAD_TIMEOUT               1
  UNMIGRATED  DD_PROFILING_URL                          1
  UNMIGRATED  DD_SITE                                   1

@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch from 14db9c7 to 952cf50 Compare June 30, 2026 20:42
@jboolean jboolean force-pushed the jb/mcp-tool-span-session-id branch from 5c4c2b1 to f6787f2 Compare July 1, 2026 13:43
@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch from 910e0f2 to 5deafee Compare July 1, 2026 13:51
@jboolean jboolean force-pushed the jb/mcp-tool-span-session-id branch from f6787f2 to 716a66d Compare July 1, 2026 14:11
@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch 2 times, most recently from 2e6bb68 to 9036f6d Compare July 1, 2026 15:02
@jboolean jboolean requested a review from a team as a code owner July 1, 2026 15:02
@jboolean jboolean changed the base branch from jb/mcp-tool-span-session-id to graphite-base/4944 July 1, 2026 16:07
@jboolean jboolean force-pushed the graphite-base/4944 branch from 716a66d to f6787f2 Compare July 1, 2026 16:07
@jboolean jboolean force-pushed the jb/mcp-conditional-intent-capture branch from 9036f6d to 952cf50 Compare July 1, 2026 16:07
@jboolean jboolean changed the base branch from graphite-base/4944 to jb/mcp-tool-span-session-id July 1, 2026 16:08
Add IntentCaptureEnabledFunc to TracingConfig: a per-request predicate that
gates intent capture at runtime, enabling toggling per org/feature flag
without restarting the server.

When non-nil, the predicate is consulted on every tools/list and tools/call:
returning false makes that request behave as if intent capture were disabled
(no schema injection, no telemetry stripping, no intent annotation).

The static IntentCaptureEnabled bool is preserved for back-compat; if both
are set the predicate wins. The injection hook and tool-call middleware
were refactored into factory functions taking the predicate.

Generalizes the conditional intent-capture pattern that the internal
dd-source copy uses (no single PR — landed across several commits there).
Base automatically changed from jb/mcp-tool-span-session-id to main July 3, 2026 19:47
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit a0b4172 into main Jul 3, 2026
183 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the jb/mcp-conditional-intent-capture branch July 3, 2026 20:02
gh-worker-dd-mergequeue-cf854d Bot added a commit that referenced this pull request Jul 3, 2026
…bs traces (#4945)

This PR stack ports functionality added in the clone of this contrib in dd-source back to dd-trace-go.

## Summary

Add `RedactToolOutput bool` to `TracingConfig`. When set, the tool result body sent to LLMObs is replaced with `"[REDACTED]"`; the `result.IsError` flag is still honored for span error status.

This is needed when downstream access controls (e.g. org2-dac in the internal dd-source copy) forbid forwarding tool output to LLMObs traces — partner teams need to see how their tools are being used in the MCP server, but not what those tools returned.

Implements the functionality of PR [#429591](DataDog/dd-source#429591), which hardcoded the substitution to `"[REDACTED]"` in the middleware. Here it's a configuration option so the original always-on behavior remains the default for external users.

## Test plan

- [x] `TestRedactToolOutput` — success case: output is exactly `"[REDACTED]"` and the actual result body does not leak into span metadata.
- [x] `TestRedactToolOutputStillReportsIsError` — `mcp.NewToolResultError` with redaction enabled still sets `error.message` on the span; the error detail string does not appear in the output annotation.
- [x] All existing tracing and intent-capture tests still pass (output redaction defaults to off).

Stacked on #4944.

Co-authored-by: jboolean <julian.boilen@datadoghq.com>
gh-worker-dd-mergequeue-cf854d Bot added a commit that referenced this pull request Jul 6, 2026
… capture predicate (#4976)

This PR stack ports functionality added in the clone of this contrib in dd-source back to dd-trace-go (Rapid clone at `domains/api_platform/libs/go/mcp/tracing`).

## Summary

The SDK contribs, both for mcp-go and go-sdk, were cloned into dd-source in order to feature flag them. This was intended to be temporary. In order to remove the clones, we must port back divergent functionality to the SDK contribs. We also want the contribs to match.

This adds `WithIntentCapturePredicate(func(context.Context) bool) Option`. The existing `WithIntentCapture()` is now a thin wrapper that returns `true` for every request, so existing callers are unaffected. When the predicate returns false, the middleware passes through untouched (no schema injection, no telemetry stripping, no intent annotation).

## What this enables in dd-source

The Rapid clone ships its own `isIntentCaptureEnabled(ctx)` predicate inline in the middleware. With this PR, dd-source can call `WithIntentCapturePredicate(isIntentCaptureEnabled)` and delete the local fork. Source PR (initial clone with the predicate signature): DataDog/dd-source#414005

This mirrors the design of #4944 for the mark3labs contrib so both libraries match.

## Test plan

- [x] `TestIntentCapturePredicate` — same option, two states: predicate `false` skips schema injection AND leaves the telemetry argument intact in the handler args; predicate `true` injects and strips.
- [x] All existing intent-capture and tracing tests still pass.

Stacked on #4949.


---

Parallel port in the mark3labs/mcp-go contrib: #4944



Co-authored-by: jboolean <julian.boilen@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apm:ecosystem contrib/* related feature requests or bugs mergequeue-status: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants