configure_endpoint
Set up mock API endpoints with sequential responses for testing and development. Define HTTP methods, paths, and response sequences to simulate real API behavior.
Instructions
Configure a mock API endpoint with sequential responses
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | Session identifier | |
| method | Yes | HTTP method (GET, POST, etc.) | |
| path | Yes | Endpoint path (e.g., /api/users) | |
| responses | Yes | Array of responses for sequential behavior |
Implementation Reference
- src/mcp/tools.ts:6-41 (handler)The handler implementation for the configure_endpoint tool. It validates the input arguments, retrieves or creates a session using the sessionManager, and updates the endpoints map for that session.
configure_endpoint: async (args: any) => { try { const { sessionId, method, path, responses } = args; if (!sessionId || !method || !path) { return { success: false, error: 'Missing required fields: sessionId, method, path' }; } if (!responses || !Array.isArray(responses) || responses.length === 0) { return { success: false, error: 'Must provide at least one response' }; } const session = sessionManager.getOrCreate(sessionId); const key = `${method.toUpperCase()}:${path}`; session.endpoints.set(key, { method, path, responses, callCount: 0 }); return { success: true }; } catch (error: any) { return { success: false, error: `Failed to configure endpoint: ${error.message}` }; } }, - src/mcp/server.ts:32-66 (registration)The tool registration block for configure_endpoint, including the schema definition.
{ name: 'configure_endpoint', description: 'Configure a mock API endpoint with sequential responses', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'Session identifier', }, method: { type: 'string', description: 'HTTP method (GET, POST, etc.)', }, path: { type: 'string', description: 'Endpoint path (e.g., /api/users)', }, responses: { type: 'array', description: 'Array of responses for sequential behavior', items: { type: 'object', properties: { status: { type: 'number' }, headers: { type: 'object' }, body: {}, }, required: ['status'], }, }, }, required: ['sessionId', 'method', 'path', 'responses'], }, },