@@ -165,6 +165,33 @@ public function testRejectsDangerousApiParametersKey(): void
165165 );
166166 }
167167
168+ public function testSerializesEmptyResolvedApiParametersAsObjectInResponseBody (): void
169+ {
170+ $ reportUniqueId = $ this ->findReportUniqueId ($ this ->idSite , 'Actions ' , 'getPageUrls ' );
171+ self ::assertNotNull ($ reportUniqueId );
172+
173+ $ server = McpTestHelper::buildServer ();
174+ $ sessionId = McpTestHelper::initializeSession ($ server );
175+ $ payload = McpTestHelper::makeCallToolRequest (
176+ ReportProcessed::TOOL_NAME ,
177+ [
178+ 'idSite ' => $ this ->idSite ,
179+ 'period ' => 'day ' ,
180+ 'date ' => '2015-01-03 ' ,
181+ 'reportUniqueId ' => $ reportUniqueId ,
182+ 'filter_limit ' => 1 ,
183+ 'filter_offset ' => 0 ,
184+ ],
185+ __METHOD__
186+ );
187+
188+ $ response = McpTestHelper::postJson ($ server , $ payload , ['Mcp-Session-Id ' => $ sessionId ]);
189+ $ body = McpTestHelper::getResponseBody ($ response );
190+
191+ self ::assertStringContainsString ('"resolvedReport" ' , $ body );
192+ self ::assertStringContainsString ('"apiParameters":{} ' , $ body );
193+ }
194+
168195 public function testRejectsInvalidPeriodDateParameters (): void
169196 {
170197 $ reportUniqueId = $ this ->findReportUniqueId ($ this ->idSite , 'Actions ' , 'getPageUrls ' );
@@ -510,6 +537,43 @@ public function testRejectsOldGoalParameterNamesAtSchemaLevel(): void
510537 self ::assertStringContainsString ('goal_columns_mode ' , $ error ->message ?? '' );
511538 }
512539
540+ public function testAllowsUniqueIdCombinedWithEmptyListApiParameters (): void
541+ {
542+ $ reportUniqueId = $ this ->findReportUniqueId ($ this ->idSite , 'Actions ' , 'getPageUrls ' );
543+ self ::assertNotNull ($ reportUniqueId );
544+
545+ $ server = McpTestHelper::buildServer ();
546+ $ sessionId = McpTestHelper::initializeSession ($ server );
547+ $ content = McpTestHelper::callToolAndAssertSuccess (
548+ $ server ,
549+ $ sessionId ,
550+ ReportProcessed::TOOL_NAME ,
551+ [
552+ 'idSite ' => $ this ->idSite ,
553+ 'period ' => 'day ' ,
554+ 'date ' => '2015-01-03 ' ,
555+ 'reportUniqueId ' => $ reportUniqueId ,
556+ 'apiParameters ' => [],
557+ 'filter_limit ' => 1 ,
558+ 'filter_offset ' => 0 ,
559+ ],
560+ __METHOD__
561+ );
562+
563+ $ resolvedReport = $ content ['resolvedReport ' ] ?? null ;
564+ self ::assertIsArray ($ resolvedReport );
565+ self ::assertSame ($ reportUniqueId , $ resolvedReport ['uniqueId ' ] ?? null );
566+ }
567+
568+ public function testRejectsModuleActionWithNonEmptyListApiParametersAtSchemaLevel (): void
569+ {
570+ $ this ->assertInvalidSelectorArgumentsAtSchemaLevel ([
571+ 'apiModule ' => 'Actions ' ,
572+ 'apiAction ' => 'getPageUrls ' ,
573+ 'apiParameters ' => ['flat ' ],
574+ ]);
575+ }
576+
513577 public function testReturnsStrictGuidanceForAdHocSegmentInStrictArchivingMode (): void
514578 {
515579 $ reportUniqueId = $ this ->findReportUniqueId ($ this ->idSite , 'Actions ' , 'getPageUrls ' );
0 commit comments