원클릭으로
mocking-and-mcp-testing
Specialized guidelines on testing GLPI REST endpoints alongside the MCP Server protocol.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Specialized guidelines on testing GLPI REST endpoints alongside the MCP Server protocol.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | Mocking and MCP Testing |
| description | Specialized guidelines on testing GLPI REST endpoints alongside the MCP Server protocol. |
The primary objective of testing this server is to ensure the MCP input payloads from natural language prompts are well parsed, structured, and executed without directly pinging a live GLPI REST API (which depends on tokens, passwords and strict network settings).
jest.mock)You should avoid making realistic network HTTP requests from the glpi-client.ts. By abstracting src/services/, you test whether the src/tools/ correctly pass instructions.
import { myServiceFunction } from '../../services/glpi-client';
// Use jest to mock the imported dependency entirely
jest.mock('../../services/glpi-client');
You must manually specify what the mocked function should return as an asynchronous promise. E.g.:
const mockServiceFunction = myServiceFunction as jest.MockedFunction<typeof myServiceFunction>;
mockServiceFunction.mockResolvedValue({ status: 200, data: 'Mocked Ticket Object' });
The Model Context Protocol requires tools to respond with an array of structured text. Always assert that tools return exactly:
{
content: [
{
type: "text",
text: expect.any(String) // Usually JSON serialized or formatted markdown
}
]
}
Validate the catch {} mechanisms returning error strings instead of crashing the MCP Server.
mockServiceFunction.mockRejectedValue(new Error('GLPI API Timeout'));
// your expectations should verify that the MCP tool gracefully outputs the text: "Error: GLPI API Timeout".