instagram_logout
Log out of Instagram to invalidate the current session and clear saved authentication data, requiring re-login for future access.
Instructions
Logout from Instagram and clear the saved session. This will invalidate the current session and require re-authentication for future operations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/logout.ts:23-56 (handler)The execute method that handles the instagram_logout tool logic: checks login status, retrieves username if possible, logs out via igpapiClient, and returns appropriate response.async execute(args: Record<string, unknown>): Promise<ToolResult> { // Check if already logged out if (!igpapiClient.isLoggedIn()) { return { content: [ { type: "text", text: "Already logged out. No active session to clear.", }, ], }; } // Get current user info before logout (for confirmation message) let username: string | undefined; try { const currentUser = await igpapiClient.getCurrentUser(); username = currentUser.username; } catch { // User info might not be available, continue with logout anyway } // Perform logout await igpapiClient.logout(); return { content: [ { type: "text", text: `Successfully logged out from Instagram${username ? ` (${username})` : ""}.\n\nSession has been cleared. You will need to login again to use Instagram features.`, }, ], }; }
- src/tools/logout.ts:11-21 (schema)Defines the tool's metadata: name 'instagram_logout', description, and input schema with no required parameters.getDefinition(): ToolDefinition { return { name: "instagram_logout", description: "Logout from Instagram and clear the saved session. This will invalidate the current session and require re-authentication for future operations.", inputSchema: { type: "object", properties: {}, required: [], }, }; }
- src/tools/index.ts:29-29 (registration)Instantiates the LogoutTool and adds it to the central tools registry array used for MCP tool registration.new LogoutTool(),