Skip to content

Commit 87aaf5f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add mcp step subtype to synthetics multi-step api tests (DataDog#3356)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 52985e4 commit 87aaf5f

19 files changed

Lines changed: 911 additions & 10 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16342,6 +16342,7 @@ components:
1634216342
- udp
1634316343
- icmp
1634416344
- websocket
16345+
- mcp
1634516346
example: http
1634616347
type: string
1634716348
x-enum-varnames:
@@ -16353,6 +16354,7 @@ components:
1635316354
- UDP
1635416355
- ICMP
1635516356
- WEBSOCKET
16357+
- MCP
1635616358
SyntheticsAPITestType:
1635716359
default: "api"
1635816360
description: Type of the Synthetic test, `api`.
@@ -16475,6 +16477,8 @@ components:
1647516477
- $ref: "#/components/schemas/SyntheticsAssertionJSONSchemaTarget"
1647616478
- $ref: "#/components/schemas/SyntheticsAssertionXPathTarget"
1647716479
- $ref: "#/components/schemas/SyntheticsAssertionJavascript"
16480+
- $ref: "#/components/schemas/SyntheticsAssertionMCPServerCapabilitiesTarget"
16481+
- $ref: "#/components/schemas/SyntheticsAssertionMCPRespectsSpecification"
1647816482
SyntheticsAssertionBodyHashOperator:
1647916483
description: Assertion operator to apply.
1648016484
enum:
@@ -16610,6 +16614,49 @@ components:
1661016614
type: string
1661116615
x-enum-varnames:
1661216616
- JAVASCRIPT
16617+
SyntheticsAssertionMCPRespectsSpecification:
16618+
description: An assertion that verifies the MCP server response respects the MCP specification.
16619+
properties:
16620+
type:
16621+
$ref: "#/components/schemas/SyntheticsAssertionMCPRespectsSpecificationType"
16622+
required:
16623+
- type
16624+
type: object
16625+
SyntheticsAssertionMCPRespectsSpecificationType:
16626+
description: Type of the assertion.
16627+
enum:
16628+
- mcpRespectsSpecification
16629+
example: mcpRespectsSpecification
16630+
type: string
16631+
x-enum-varnames:
16632+
- MCP_RESPECTS_SPECIFICATION
16633+
SyntheticsAssertionMCPServerCapabilitiesTarget:
16634+
description: An assertion that checks that an MCP server advertises the expected capabilities.
16635+
properties:
16636+
operator:
16637+
$ref: "#/components/schemas/SyntheticsAssertionOperator"
16638+
target:
16639+
description: List of MCP server capabilities to assert against.
16640+
example:
16641+
- completions
16642+
items:
16643+
$ref: "#/components/schemas/SyntheticsMCPServerCapability"
16644+
type: array
16645+
type:
16646+
$ref: "#/components/schemas/SyntheticsAssertionMCPServerCapabilitiesType"
16647+
required:
16648+
- type
16649+
- operator
16650+
- target
16651+
type: object
16652+
SyntheticsAssertionMCPServerCapabilitiesType:
16653+
description: Type of the assertion.
16654+
enum:
16655+
- mcpServerCapabilities
16656+
example: mcpServerCapabilities
16657+
type: string
16658+
x-enum-varnames:
16659+
- MCP_SERVER_CAPABILITIES
1661316660
SyntheticsAssertionOperator:
1661416661
description: Assertion operator to apply.
1661516662
enum:
@@ -16712,6 +16759,8 @@ components:
1671216759
- connection
1671316760
- multiNetworkHop
1671416761
- jitter
16762+
- mcpToolNameLength
16763+
- mcpToolCount
1671516764
example: statusCode
1671616765
type: string
1671716766
x-enum-varnames:
@@ -16736,6 +16785,8 @@ components:
1673616785
- CONNECTION
1673716786
- MULTI_NETWORK_HOP
1673816787
- JITTER
16788+
- MCP_TOOL_NAME_LENGTH
16789+
- MCP_TOOL_COUNT
1673916790
SyntheticsAssertionXPathOperator:
1674016791
description: Assertion operator to apply.
1674116792
enum:
@@ -18044,6 +18095,31 @@ components:
1804418095
$ref: "#/components/schemas/SyntheticsLocation"
1804518096
type: array
1804618097
type: object
18098+
SyntheticsMCPProtocolVersion:
18099+
description: The MCP protocol version used by the step. See https://modelcontextprotocol.io/specification.
18100+
enum:
18101+
- "2025-06-18"
18102+
example: "2025-06-18"
18103+
type: string
18104+
x-enum-varnames:
18105+
- VERSION_2025_06_18
18106+
SyntheticsMCPServerCapability:
18107+
description: A capability advertised by an MCP server.
18108+
enum:
18109+
- completions
18110+
- experimental
18111+
- logging
18112+
- prompts
18113+
- resources
18114+
- tools
18115+
type: string
18116+
x-enum-varnames:
18117+
- COMPLETIONS
18118+
- EXPERIMENTAL
18119+
- LOGGING
18120+
- PROMPTS
18121+
- RESOURCES
18122+
- TOOLS
1804718123
SyntheticsMobileStep:
1804818124
description: The steps used in a Synthetic mobile test.
1804918125
properties:
@@ -18933,15 +19009,24 @@ components:
1893319009
- UPLOAD_FILES
1893419010
- WAIT
1893519011
SyntheticsTestCallType:
18936-
description: The type of gRPC call to perform.
19012+
description: |-
19013+
The type of call to perform. Used by gRPC steps (`healthcheck`, `unary`)
19014+
and MCP steps (`init`, `tool_list`, `tool_call`). Valid values depend on
19015+
the parent step's `subtype`.
1893719016
enum:
1893819017
- healthcheck
1893919018
- unary
19019+
- init
19020+
- tool_list
19021+
- tool_call
1894019022
example: unary
1894119023
type: string
1894219024
x-enum-varnames:
1894319025
- HEALTHCHECK
1894419026
- UNARY
19027+
- INIT
19028+
- TOOL_LIST
19029+
- TOOL_CALL
1894519030
SyntheticsTestCiOptions:
1894619031
description: CI/CD options for a Synthetic test.
1894719032
properties:
@@ -19442,6 +19527,8 @@ components:
1944219527
isMessageBase64Encoded:
1944319528
description: Whether the message is base64 encoded.
1944419529
type: boolean
19530+
mcpProtocolVersion:
19531+
$ref: "#/components/schemas/SyntheticsMCPProtocolVersion"
1944519532
message:
1944619533
description: Message to send for UDP or WebSocket tests.
1944719534
type: string
@@ -19486,6 +19573,14 @@ components:
1948619573
description: Timeout in seconds for the test.
1948719574
format: double
1948819575
type: number
19576+
toolArgs:
19577+
additionalProperties: {}
19578+
description: Arguments to pass to the MCP tool. Free-form object whose shape depends on the tool. Used when `callType` is `tool_call`.
19579+
type: object
19580+
toolName:
19581+
description: The name of the MCP tool to call. Required when `callType` is `tool_call`.
19582+
example: search
19583+
type: string
1948919584
url:
1949019585
description: URL to perform the test with.
1949119586
example: "https://example.com"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-05-19T16:45:21.251Z

cassettes/features/v1/synthetics/Create-an-API-test-with-MCP-steps-returns-OK-Returns-the-created-test-details-response.yml

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Create an API test with MCP steps returns "OK - Returns the created test details." response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
5+
6+
body = DatadogAPIClient::V1::SyntheticsAPITest.new({
7+
config: DatadogAPIClient::V1::SyntheticsAPITestConfig.new({
8+
steps: [
9+
DatadogAPIClient::V1::SyntheticsAPITestStep.new({
10+
name: "Initialize MCP session",
11+
subtype: DatadogAPIClient::V1::SyntheticsAPITestStepSubtype::MCP,
12+
allow_failure: false,
13+
is_critical: true,
14+
_retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
15+
count: 0,
16+
interval: 300,
17+
}),
18+
assertions: [
19+
DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
20+
operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
21+
type: DatadogAPIClient::V1::SyntheticsAssertionType::STATUS_CODE,
22+
target: 200,
23+
}),
24+
DatadogAPIClient::V1::SyntheticsAssertionMCPRespectsSpecification.new({
25+
type: DatadogAPIClient::V1::SyntheticsAssertionMCPRespectsSpecificationType::MCP_RESPECTS_SPECIFICATION,
26+
}),
27+
DatadogAPIClient::V1::SyntheticsAssertionMCPServerCapabilitiesTarget.new({
28+
operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::CONTAINS,
29+
type: DatadogAPIClient::V1::SyntheticsAssertionMCPServerCapabilitiesType::MCP_SERVER_CAPABILITIES,
30+
target: [
31+
DatadogAPIClient::V1::SyntheticsMCPServerCapability::TOOLS,
32+
],
33+
}),
34+
],
35+
request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
36+
url: "https://example.org/mcp",
37+
call_type: DatadogAPIClient::V1::SyntheticsTestCallType::INIT,
38+
mcp_protocol_version: DatadogAPIClient::V1::SyntheticsMCPProtocolVersion::VERSION_2025_06_18,
39+
headers: {
40+
"DD-API-KEY" => "<YOUR-API-KEY>", "DD-APPLICATION-KEY" => "<YOUR-APP-KEY>",
41+
},
42+
}),
43+
}),
44+
DatadogAPIClient::V1::SyntheticsAPITestStep.new({
45+
name: "List MCP tools",
46+
subtype: DatadogAPIClient::V1::SyntheticsAPITestStepSubtype::MCP,
47+
allow_failure: false,
48+
is_critical: true,
49+
_retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
50+
count: 0,
51+
interval: 300,
52+
}),
53+
assertions: [
54+
DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
55+
operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
56+
type: DatadogAPIClient::V1::SyntheticsAssertionType::STATUS_CODE,
57+
target: 200,
58+
}),
59+
DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
60+
operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::MORE_THAN,
61+
type: DatadogAPIClient::V1::SyntheticsAssertionType::MCP_TOOL_COUNT,
62+
target: 0,
63+
}),
64+
DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
65+
operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::LESS_THAN,
66+
type: DatadogAPIClient::V1::SyntheticsAssertionType::MCP_TOOL_NAME_LENGTH,
67+
target: 64,
68+
}),
69+
DatadogAPIClient::V1::SyntheticsAssertionMCPRespectsSpecification.new({
70+
type: DatadogAPIClient::V1::SyntheticsAssertionMCPRespectsSpecificationType::MCP_RESPECTS_SPECIFICATION,
71+
}),
72+
],
73+
request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
74+
url: "https://example.org/mcp",
75+
call_type: DatadogAPIClient::V1::SyntheticsTestCallType::TOOL_LIST,
76+
mcp_protocol_version: DatadogAPIClient::V1::SyntheticsMCPProtocolVersion::VERSION_2025_06_18,
77+
headers: {
78+
"DD-API-KEY" => "<YOUR-API-KEY>", "DD-APPLICATION-KEY" => "<YOUR-APP-KEY>",
79+
},
80+
}),
81+
}),
82+
DatadogAPIClient::V1::SyntheticsAPITestStep.new({
83+
name: "Call MCP search tool",
84+
subtype: DatadogAPIClient::V1::SyntheticsAPITestStepSubtype::MCP,
85+
allow_failure: false,
86+
is_critical: true,
87+
_retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
88+
count: 0,
89+
interval: 300,
90+
}),
91+
assertions: [
92+
DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
93+
operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::IS,
94+
type: DatadogAPIClient::V1::SyntheticsAssertionType::STATUS_CODE,
95+
target: 200,
96+
}),
97+
DatadogAPIClient::V1::SyntheticsAssertionTarget.new({
98+
operator: DatadogAPIClient::V1::SyntheticsAssertionOperator::LESS_THAN,
99+
type: DatadogAPIClient::V1::SyntheticsAssertionType::RESPONSE_TIME,
100+
target: 5000,
101+
}),
102+
DatadogAPIClient::V1::SyntheticsAssertionMCPRespectsSpecification.new({
103+
type: DatadogAPIClient::V1::SyntheticsAssertionMCPRespectsSpecificationType::MCP_RESPECTS_SPECIFICATION,
104+
}),
105+
],
106+
request: DatadogAPIClient::V1::SyntheticsTestRequest.new({
107+
url: "https://example.org/mcp",
108+
call_type: DatadogAPIClient::V1::SyntheticsTestCallType::TOOL_CALL,
109+
mcp_protocol_version: DatadogAPIClient::V1::SyntheticsMCPProtocolVersion::VERSION_2025_06_18,
110+
tool_name: "search",
111+
tool_args: {
112+
"limit": "5", "query": "datadog synthetics",
113+
},
114+
headers: {
115+
"DD-API-KEY" => "<YOUR-API-KEY>", "DD-APPLICATION-KEY" => "<YOUR-APP-KEY>",
116+
},
117+
}),
118+
}),
119+
],
120+
}),
121+
locations: [
122+
"aws:us-east-2",
123+
],
124+
message: "BDD test payload: synthetics_api_test_mcp_payload.json",
125+
name: "Example-Synthetic",
126+
options: DatadogAPIClient::V1::SyntheticsTestOptions.new({
127+
min_failure_duration: 10,
128+
min_location_failed: 1,
129+
monitor_name: "Example-Synthetic",
130+
monitor_priority: 5,
131+
_retry: DatadogAPIClient::V1::SyntheticsTestOptionsRetry.new({
132+
count: 3,
133+
interval: 1000,
134+
}),
135+
tick_every: 900,
136+
}),
137+
subtype: DatadogAPIClient::V1::SyntheticsTestDetailsSubType::MULTI,
138+
tags: [
139+
"testing:api",
140+
],
141+
type: DatadogAPIClient::V1::SyntheticsAPITestType::API,
142+
})
143+
p api_instance.create_synthetics_api_test(body)

examples/v1/synthetics/UpdateBrowserTest.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
DatadogAPIClient::V1::SyntheticsTestRequestBodyFile.new({}),
3131
],
3232
http_version: DatadogAPIClient::V1::SyntheticsTestOptionsHTTPVersion::HTTP1,
33+
mcp_protocol_version: DatadogAPIClient::V1::SyntheticsMCPProtocolVersion::VERSION_2025_06_18,
3334
proxy: DatadogAPIClient::V1::SyntheticsTestRequestProxy.new({
3435
url: "https://example.com",
3536
}),
3637
service: "Greeter",
38+
tool_name: "search",
3739
url: "https://example.com",
3840
}),
3941
variables: [

0 commit comments

Comments
 (0)