test_httpbin
Test HTTP requests and responses by sending various HTTP methods to HTTPBin endpoints for debugging and validation purposes.
Instructions
Test HTTP requests and responses using HTTPBin
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | HTTP method to test | GET |
| endpoint | No | HTTPBin endpoint to test | get |
Implementation Reference
- src/tools/testing/jsonplaceholder-tools.ts:126-185 (registration)Primary registration of the 'test_httpbin' tool, including name, description, input schema, and execute handler function that simulates HTTPBin API responses.registry.registerTool({ name: 'test_httpbin', description: 'Test HTTP requests and responses using HTTPBin', category: 'testing', source: 'HTTPBin', inputSchema: { type: 'object', properties: { method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], description: 'HTTP method to test', default: 'GET' }, endpoint: { type: 'string', description: 'HTTPBin endpoint to test', default: 'get' } }, required: [] }, execute: async (args: ToolInput): Promise<ToolOutput> => { try { const { method = 'GET', endpoint = 'get' } = args; // Simulate HTTPBin response const mockResponse = { args: {}, headers: { 'Accept': 'application/json', 'User-Agent': 'Open-Search-MCP/1.0' }, origin: '127.0.0.1', url: `https://httpbin.org/${endpoint}`, method: method }; return { success: true, data: { method, endpoint, response: mockResponse, status: 'success' }, metadata: { tool: 'test_httpbin', timestamp: new Date().toISOString() } }; } catch (error) { return { success: false, error: `HTTPBin test failed: ${error instanceof Error ? error.message : String(error)}`, data: null }; } } });
- The core handler (execute function) for 'test_httpbin' that processes input parameters (method, endpoint) and returns a mocked HTTPBin response.execute: async (args: ToolInput): Promise<ToolOutput> => { try { const { method = 'GET', endpoint = 'get' } = args; // Simulate HTTPBin response const mockResponse = { args: {}, headers: { 'Accept': 'application/json', 'User-Agent': 'Open-Search-MCP/1.0' }, origin: '127.0.0.1', url: `https://httpbin.org/${endpoint}`, method: method }; return { success: true, data: { method, endpoint, response: mockResponse, status: 'success' }, metadata: { tool: 'test_httpbin', timestamp: new Date().toISOString() } }; } catch (error) { return { success: false, error: `HTTPBin test failed: ${error instanceof Error ? error.message : String(error)}`, data: null }; } }
- Input schema defining parameters for the test_httpbin tool: HTTP method (enum) and endpoint (string).inputSchema: { type: 'object', properties: { method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], description: 'HTTP method to test', default: 'GET' }, endpoint: { type: 'string', description: 'HTTPBin endpoint to test', default: 'get' } }, required: [] },
- src/index.ts:245-245 (registration)Top-level registration call in main server initialization that registers the test_httpbin tool via the jsonplaceholder-tools module.registerJSONPlaceholderTools(this.toolRegistry); // 2 tools: test_jsonplaceholder, test_httpbin