setMode
Switch between 'student' and 'professional' modes to tailor the Pentest MCP server's functionality for educational or advanced penetration testing workflows.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes |
Implementation Reference
- src/index.ts:667-671 (handler)The handler function for the 'setMode' tool. It updates the global currentUserSession.mode based on the input and logs the change using logMessage. Returns a confirmation text message describing the new mode.server.tool("setMode", setModeToolSchema.shape, async ({ mode } /*, extra */) => { currentUserSession.mode = mode; await logMessage(`Mode changed to ${mode}.`); return { content: [{ type: "text", text: `Session mode set to: ${mode}` }] }; });
- src/index.ts:660-666 (schema)Zod schema defining the input parameters for the 'setMode' tool. Requires a 'mode' field that must be either UserMode.STUDENT ('student') or UserMode.PROFESSIONAL ('professional'). Includes a descriptive docstring.const setModeToolSchema = z.object({ mode: z.enum([UserMode.STUDENT, UserMode.PROFESSIONAL]) }).describe( "Switch between `student` mode (verbose guidance) and `professional` mode " + "(concise output). Call this at the start of a session or whenever you " + "need to adjust the level of explanation. Example: `{\"mode\":\"professional\"}`" );
- src/index.ts:667-667 (registration)The server.tool call registers the 'setMode' tool with the MCP server, providing the schema and handler function.server.tool("setMode", setModeToolSchema.shape, async ({ mode } /*, extra */) => {
- src/index.ts:605-605 (registration)The 'setMode' tool is declared in the server's capabilities object, enabling client discovery of available tools."setMode": {},
- src/types.ts:1-5 (helper)Type definition for UserMode enum used in the setMode tool schema and session state.export enum UserMode { UNKNOWN = 'unknown', STUDENT = 'student', PROFESSIONAL = 'professional', }