Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 96 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16342,6 +16342,7 @@ components:
- udp
- icmp
- websocket
- mcp
example: http
type: string
x-enum-varnames:
Expand All @@ -16353,6 +16354,7 @@ components:
- UDP
- ICMP
- WEBSOCKET
- MCP
SyntheticsAPITestType:
default: "api"
description: Type of the Synthetic test, `api`.
Expand Down Expand Up @@ -16475,6 +16477,8 @@ components:
- $ref: "#/components/schemas/SyntheticsAssertionJSONSchemaTarget"
- $ref: "#/components/schemas/SyntheticsAssertionXPathTarget"
- $ref: "#/components/schemas/SyntheticsAssertionJavascript"
- $ref: "#/components/schemas/SyntheticsAssertionMCPServerCapabilitiesTarget"
- $ref: "#/components/schemas/SyntheticsAssertionMCPRespectsSpecification"
SyntheticsAssertionBodyHashOperator:
description: Assertion operator to apply.
enum:
Expand Down Expand Up @@ -16610,6 +16614,49 @@ components:
type: string
x-enum-varnames:
- JAVASCRIPT
SyntheticsAssertionMCPRespectsSpecification:
description: An assertion that verifies the MCP server response respects the MCP specification.
properties:
type:
$ref: "#/components/schemas/SyntheticsAssertionMCPRespectsSpecificationType"
required:
- type
type: object
SyntheticsAssertionMCPRespectsSpecificationType:
description: Type of the assertion.
enum:
- mcpRespectsSpecification
example: mcpRespectsSpecification
type: string
x-enum-varnames:
- MCP_RESPECTS_SPECIFICATION
SyntheticsAssertionMCPServerCapabilitiesTarget:
description: An assertion that checks that an MCP server advertises the expected capabilities.
properties:
operator:
$ref: "#/components/schemas/SyntheticsAssertionOperator"
target:
description: List of MCP server capabilities to assert against.
example:
- completions
items:
$ref: "#/components/schemas/SyntheticsMCPServerCapability"
type: array
type:
$ref: "#/components/schemas/SyntheticsAssertionMCPServerCapabilitiesType"
required:
- type
- operator
- target
type: object
SyntheticsAssertionMCPServerCapabilitiesType:
description: Type of the assertion.
enum:
- mcpServerCapabilities
example: mcpServerCapabilities
type: string
x-enum-varnames:
- MCP_SERVER_CAPABILITIES
SyntheticsAssertionOperator:
description: Assertion operator to apply.
enum:
Expand Down Expand Up @@ -16712,6 +16759,8 @@ components:
- connection
- multiNetworkHop
- jitter
- mcpToolNameLength
- mcpToolCount
example: statusCode
type: string
x-enum-varnames:
Expand All @@ -16736,6 +16785,8 @@ components:
- CONNECTION
- MULTI_NETWORK_HOP
- JITTER
- MCP_TOOL_NAME_LENGTH
- MCP_TOOL_COUNT
SyntheticsAssertionXPathOperator:
description: Assertion operator to apply.
enum:
Expand Down Expand Up @@ -18044,6 +18095,31 @@ components:
$ref: "#/components/schemas/SyntheticsLocation"
type: array
type: object
SyntheticsMCPProtocolVersion:
description: The MCP protocol version used by the step. See https://modelcontextprotocol.io/specification.
enum:
- "2025-06-18"
example: "2025-06-18"
type: string
x-enum-varnames:
- VERSION_2025_06_18
SyntheticsMCPServerCapability:
description: A capability advertised by an MCP server.
enum:
- completions
- experimental
- logging
- prompts
- resources
- tools
type: string
x-enum-varnames:
- COMPLETIONS
- EXPERIMENTAL
- LOGGING
- PROMPTS
- RESOURCES
- TOOLS
SyntheticsMobileStep:
description: The steps used in a Synthetic mobile test.
properties:
Expand Down Expand Up @@ -18933,15 +19009,24 @@ components:
- UPLOAD_FILES
- WAIT
SyntheticsTestCallType:
description: The type of gRPC call to perform.
description: |-
The type of call to perform. Used by gRPC steps (`healthcheck`, `unary`)
and MCP steps (`init`, `tool_list`, `tool_call`). Valid values depend on
the parent step's `subtype`.
enum:
- healthcheck
- unary
- init
- tool_list
- tool_call
example: unary
type: string
x-enum-varnames:
- HEALTHCHECK
- UNARY
- INIT
- TOOL_LIST
- TOOL_CALL
SyntheticsTestCiOptions:
description: CI/CD options for a Synthetic test.
properties:
Expand Down Expand Up @@ -19442,6 +19527,8 @@ components:
isMessageBase64Encoded:
description: Whether the message is base64 encoded.
type: boolean
mcpProtocolVersion:
$ref: "#/components/schemas/SyntheticsMCPProtocolVersion"
message:
description: Message to send for UDP or WebSocket tests.
type: string
Expand Down Expand Up @@ -19486,6 +19573,14 @@ components:
description: Timeout in seconds for the test.
format: double
type: number
toolArgs:
additionalProperties: {}
description: Arguments to pass to the MCP tool. Free-form object whose shape depends on the tool. Used when `callType` is `tool_call`.
type: object
toolName:
description: The name of the MCP tool to call. Required when `callType` is `tool_call`.
example: search
type: string
url:
description: URL to perform the test with.
example: "https://example.com"
Expand Down
201 changes: 201 additions & 0 deletions examples/v1/synthetics/CreateSyntheticsAPITest_2547523542.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
// Create an API test with MCP steps returns "OK - Returns the created test details." response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsAPIStep;
import com.datadog.api.client.v1.model.SyntheticsAPITest;
import com.datadog.api.client.v1.model.SyntheticsAPITestConfig;
import com.datadog.api.client.v1.model.SyntheticsAPITestStep;
import com.datadog.api.client.v1.model.SyntheticsAPITestStepSubtype;
import com.datadog.api.client.v1.model.SyntheticsAPITestType;
import com.datadog.api.client.v1.model.SyntheticsAssertion;
import com.datadog.api.client.v1.model.SyntheticsAssertionMCPRespectsSpecification;
import com.datadog.api.client.v1.model.SyntheticsAssertionMCPRespectsSpecificationType;
import com.datadog.api.client.v1.model.SyntheticsAssertionMCPServerCapabilitiesTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionMCPServerCapabilitiesType;
import com.datadog.api.client.v1.model.SyntheticsAssertionOperator;
import com.datadog.api.client.v1.model.SyntheticsAssertionTarget;
import com.datadog.api.client.v1.model.SyntheticsAssertionTargetValue;
import com.datadog.api.client.v1.model.SyntheticsAssertionType;
import com.datadog.api.client.v1.model.SyntheticsMCPProtocolVersion;
import com.datadog.api.client.v1.model.SyntheticsMCPServerCapability;
import com.datadog.api.client.v1.model.SyntheticsTestCallType;
import com.datadog.api.client.v1.model.SyntheticsTestDetailsSubType;
import com.datadog.api.client.v1.model.SyntheticsTestOptions;
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);

SyntheticsAPITest body =
new SyntheticsAPITest()
.config(
new SyntheticsAPITestConfig()
.steps(
Arrays.asList(
new SyntheticsAPIStep(
new SyntheticsAPITestStep()
.name("Initialize MCP session")
.subtype(SyntheticsAPITestStepSubtype.MCP)
.allowFailure(false)
.isCritical(true)
.retry(
new SyntheticsTestOptionsRetry().count(0L).interval(300.0))
.assertions(
Arrays.asList(
new SyntheticsAssertion(
new SyntheticsAssertionTarget()
.operator(SyntheticsAssertionOperator.IS)
.type(SyntheticsAssertionType.STATUS_CODE)
.target(
new SyntheticsAssertionTargetValue(200.0))),
new SyntheticsAssertion(
new SyntheticsAssertionMCPRespectsSpecification()
.type(
SyntheticsAssertionMCPRespectsSpecificationType
.MCP_RESPECTS_SPECIFICATION)),
new SyntheticsAssertion(
new SyntheticsAssertionMCPServerCapabilitiesTarget()
.operator(SyntheticsAssertionOperator.CONTAINS)
.type(
SyntheticsAssertionMCPServerCapabilitiesType
.MCP_SERVER_CAPABILITIES)
.target(
Collections.singletonList(
SyntheticsMCPServerCapability.TOOLS)))))
.request(
new SyntheticsTestRequest()
.url("https://example.org/mcp")
.callType(SyntheticsTestCallType.INIT)
.mcpProtocolVersion(
SyntheticsMCPProtocolVersion.VERSION_2025_06_18)
.headers(
Map.ofEntries(
Map.entry("DD-API-KEY", "<YOUR-API-KEY>"),
Map.entry(
"DD-APPLICATION-KEY", "<YOUR-APP-KEY>"))))),
new SyntheticsAPIStep(
new SyntheticsAPITestStep()
.name("List MCP tools")
.subtype(SyntheticsAPITestStepSubtype.MCP)
.allowFailure(false)
.isCritical(true)
.retry(
new SyntheticsTestOptionsRetry().count(0L).interval(300.0))
.assertions(
Arrays.asList(
new SyntheticsAssertion(
new SyntheticsAssertionTarget()
.operator(SyntheticsAssertionOperator.IS)
.type(SyntheticsAssertionType.STATUS_CODE)
.target(
new SyntheticsAssertionTargetValue(200.0))),
new SyntheticsAssertion(
new SyntheticsAssertionTarget()
.operator(SyntheticsAssertionOperator.MORE_THAN)
.type(SyntheticsAssertionType.MCP_TOOL_COUNT)
.target(
new SyntheticsAssertionTargetValue(0.0))),
new SyntheticsAssertion(
new SyntheticsAssertionTarget()
.operator(SyntheticsAssertionOperator.LESS_THAN)
.type(
SyntheticsAssertionType
.MCP_TOOL_NAME_LENGTH)
.target(
new SyntheticsAssertionTargetValue(64.0))),
new SyntheticsAssertion(
new SyntheticsAssertionMCPRespectsSpecification()
.type(
SyntheticsAssertionMCPRespectsSpecificationType
.MCP_RESPECTS_SPECIFICATION))))
.request(
new SyntheticsTestRequest()
.url("https://example.org/mcp")
.callType(SyntheticsTestCallType.TOOL_LIST)
.mcpProtocolVersion(
SyntheticsMCPProtocolVersion.VERSION_2025_06_18)
.headers(
Map.ofEntries(
Map.entry("DD-API-KEY", "<YOUR-API-KEY>"),
Map.entry(
"DD-APPLICATION-KEY", "<YOUR-APP-KEY>"))))),
new SyntheticsAPIStep(
new SyntheticsAPITestStep()
.name("Call MCP search tool")
.subtype(SyntheticsAPITestStepSubtype.MCP)
.allowFailure(false)
.isCritical(true)
.retry(
new SyntheticsTestOptionsRetry().count(0L).interval(300.0))
.assertions(
Arrays.asList(
new SyntheticsAssertion(
new SyntheticsAssertionTarget()
.operator(SyntheticsAssertionOperator.IS)
.type(SyntheticsAssertionType.STATUS_CODE)
.target(
new SyntheticsAssertionTargetValue(200.0))),
new SyntheticsAssertion(
new SyntheticsAssertionTarget()
.operator(SyntheticsAssertionOperator.LESS_THAN)
.type(SyntheticsAssertionType.RESPONSE_TIME)
.target(
new SyntheticsAssertionTargetValue(
5000.0))),
new SyntheticsAssertion(
new SyntheticsAssertionMCPRespectsSpecification()
.type(
SyntheticsAssertionMCPRespectsSpecificationType
.MCP_RESPECTS_SPECIFICATION))))
.request(
new SyntheticsTestRequest()
.url("https://example.org/mcp")
.callType(SyntheticsTestCallType.TOOL_CALL)
.mcpProtocolVersion(
SyntheticsMCPProtocolVersion.VERSION_2025_06_18)
.toolName("search")
.toolArgs(
Map.ofEntries(
Map.entry("limit", "5"),
Map.entry("query", "datadog synthetics")))
.headers(
Map.ofEntries(
Map.entry("DD-API-KEY", "<YOUR-API-KEY>"),
Map.entry(
"DD-APPLICATION-KEY",
"<YOUR-APP-KEY>"))))))))
.locations(Collections.singletonList("aws:us-east-2"))
.message("BDD test payload: synthetics_api_test_mcp_payload.json")
.name("Example-Synthetic")
.options(
new SyntheticsTestOptions()
.minFailureDuration(10L)
.minLocationFailed(1L)
.monitorName("Example-Synthetic")
.monitorPriority(5)
.retry(new SyntheticsTestOptionsRetry().count(3L).interval(1000.0))
.tickEvery(900L))
.subtype(SyntheticsTestDetailsSubType.MULTI)
.tags(Collections.singletonList("testing:api"))
.type(SyntheticsAPITestType.API);

try {
SyntheticsAPITest result = apiInstance.createSyntheticsAPITest(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#createSyntheticsAPITest");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Loading
Loading