mcp-cisco-support
Version:
MCP server for Cisco Support APIs including Bug Search and future tools
74 lines • 5.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const globals_1 = require("@jest/globals");
const mcp_server_js_1 = require("../src/mcp-server.js");
(0, globals_1.describe)('Elicitation Request Tests', () => {
let server;
(0, globals_1.beforeEach)(() => {
server = (0, mcp_server_js_1.createMCPServer)();
});
(0, globals_1.it)('should create elicitation request helper function', () => {
const request = (0, mcp_server_js_1.createElicitationRequest)('Please provide your API credentials', mcp_server_js_1.ElicitationSchemas.apiCredentials);
(0, globals_1.expect)(request).toHaveProperty('method', 'elicitation/create');
(0, globals_1.expect)(request).toHaveProperty('params');
(0, globals_1.expect)(request.params).toHaveProperty('message', 'Please provide your API credentials');
(0, globals_1.expect)(request.params).toHaveProperty('requestedSchema');
(0, globals_1.expect)(request.params.requestedSchema).toEqual(mcp_server_js_1.ElicitationSchemas.apiCredentials);
});
(0, globals_1.it)('should have elicitation capability declared', () => {
// Test that the server was created successfully
(0, globals_1.expect)(server).toBeDefined();
(0, globals_1.expect)(server.setRequestHandler).toBeDefined();
// The capabilities are internal to the server, so we can't directly test them
// But we can verify the server was created with the expected structure
});
(0, globals_1.it)('should have predefined elicitation schemas', () => {
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas).toHaveProperty('apiCredentials');
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas).toHaveProperty('searchRefinement');
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas).toHaveProperty('userConfirmation');
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas).toHaveProperty('productSelection');
// Verify apiCredentials schema structure
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas.apiCredentials).toHaveProperty('type', 'object');
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas.apiCredentials).toHaveProperty('properties');
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas.apiCredentials.properties).toHaveProperty('clientId');
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas.apiCredentials.properties).toHaveProperty('confirm');
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas.apiCredentials).toHaveProperty('required');
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas.apiCredentials.required).toContain('clientId');
(0, globals_1.expect)(mcp_server_js_1.ElicitationSchemas.apiCredentials.required).toContain('confirm');
});
(0, globals_1.it)('should validate searchRefinement schema', () => {
const schema = mcp_server_js_1.ElicitationSchemas.searchRefinement;
(0, globals_1.expect)(schema.properties.severity).toHaveProperty('enum');
(0, globals_1.expect)(schema.properties.severity.enum).toContain('1');
(0, globals_1.expect)(schema.properties.severity.enum).toContain('6');
(0, globals_1.expect)(schema.properties.status).toHaveProperty('enum');
(0, globals_1.expect)(schema.properties.status.enum).toContain('O');
(0, globals_1.expect)(schema.properties.status.enum).toContain('F');
(0, globals_1.expect)(schema.properties.dateRange).toHaveProperty('enum');
(0, globals_1.expect)(schema.properties.dateRange.enum).toContain('1');
(0, globals_1.expect)(schema.properties.dateRange.enum).toContain('5');
});
(0, globals_1.it)('should validate userConfirmation schema', () => {
const schema = mcp_server_js_1.ElicitationSchemas.userConfirmation;
(0, globals_1.expect)(schema.properties.confirmed).toHaveProperty('type', 'boolean');
(0, globals_1.expect)(schema.properties.reason).toHaveProperty('type', 'string');
(0, globals_1.expect)(schema.required).toContain('confirmed');
(0, globals_1.expect)(schema.required).toHaveLength(1);
});
(0, globals_1.it)('should validate productSelection schema', () => {
const schema = mcp_server_js_1.ElicitationSchemas.productSelection;
(0, globals_1.expect)(schema.properties.selectedProduct).toHaveProperty('type', 'string');
(0, globals_1.expect)(schema.properties.version).toHaveProperty('type', 'string');
(0, globals_1.expect)(schema.required).toContain('selectedProduct');
(0, globals_1.expect)(schema.required).toHaveLength(1);
});
(0, globals_1.it)('should create various elicitation requests', () => {
const credentialsRequest = (0, mcp_server_js_1.createElicitationRequest)('Please provide your Cisco API credentials', mcp_server_js_1.ElicitationSchemas.apiCredentials);
const searchRequest = (0, mcp_server_js_1.createElicitationRequest)('Please refine your search parameters', mcp_server_js_1.ElicitationSchemas.searchRefinement);
const confirmationRequest = (0, mcp_server_js_1.createElicitationRequest)('This action will modify your configuration. Do you want to proceed?', mcp_server_js_1.ElicitationSchemas.userConfirmation);
(0, globals_1.expect)(credentialsRequest.params.message).toBe('Please provide your Cisco API credentials');
(0, globals_1.expect)(searchRequest.params.message).toBe('Please refine your search parameters');
(0, globals_1.expect)(confirmationRequest.params.message).toBe('This action will modify your configuration. Do you want to proceed?');
});
});
//# sourceMappingURL=elicitation.test.js.map