Skip to content

Conversation

@CodeWithKyrian
Copy link
Contributor

This PR introduces comprehensive HTTP inspector tests and significantly improves the inspector tests' architecture, enabling proper testing of HTTP transport functionality alongside the existing STDIO tests.

Motivation and Context

  • Limited Test Coverage: Previously, only STDIO transport was tested, leaving HTTP changes untested
  • Basic Testing: Existing tests were limited to basic list methods (tools/list, prompts/list, resources/list, resource_templates/list) with minimal coverage of complex operations
  • Poor Extensibility: The test framework lacked structure for easily adding new test scenarios
  • No Parameter Testing: Very few tests actually executed tools/call, resources/read, or prompts/get with parameters

What's Changed

  • Added HttpInspectorSnapshotTestCase: Base class for HTTP testing with built-in PHP server management
  • Created HTTP Test Cases: Added comprehensive tests for all HTTP examples:
    • HttpCombinedRegistrationTest: Tests mixed manual and attribute-based registration
    • HttpComplexToolSchemaTest: Tests complex tool schemas with validation
    • HttpDiscoveryUserProfileTest: Tests discovery-based tools, resources, and prompts
    • HttpSchemaShowcaseTest: Tests various schema validation scenarios
    • HttpClientCommunicationTest: Prepared for client communication (currently skipped)
  • Enhanced Test Framework: Improved InspectorSnapshotTestCase to support complex method options for tools/call, resources/read, prompts/get with parameters
  • Better Organization: Proper inheritance hierarchy with separate base classes for STDIO and HTTP testing

Breaking Changes

None

{
protected function setUp(): void
{
$this->markTestSkipped('Test skipped: SDK cannot handle logging/setLevel requests required by logging capability, and built-in PHP server does not support sampling.');
Copy link
Member

Choose a reason for hiding this comment

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

any ideas how to deal with this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the logging part, since logging doesn't need to wait for response, the Built in PHP server still works, we just need to implement handling of logging/setLevel method in the SDK and we're good to go (In another PR obviously)

As for sampling, I honestly don't know just yet.

@CodeWithKyrian CodeWithKyrian force-pushed the feat/inspector-tests-for-http branch from 30bd60f to 016a9a0 Compare October 30, 2025 16:34
@CodeWithKyrian CodeWithKyrian merged commit 757b959 into modelcontextprotocol:main Oct 30, 2025
10 checks passed
@CodeWithKyrian CodeWithKyrian deleted the feat/inspector-tests-for-http branch October 30, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants