whoami
Identify the current system user by returning their username. Use this tool to verify user identity quickly and directly.
Instructions
Returns the username of the current system user as my identity.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:9-18 (handler)The handler function for the 'whoami' MCP tool. It retrieves the current system username using getpass.getuser() and returns it as a string, with error handling that returns an error dictionary.def whoami() -> str: """Returns the username of the current system user as my identity.""" try: # Get the current system username using getpass.getuser() username = getpass.getuser() # Return a simple dictionary with the username return username except Exception as e: # Handle any unexpected errors (e.g., environment issues) return {"error": f"Failed to fetch username: {str(e)}"}
- main.py:8-8 (registration)Registers the 'whoami' function as an MCP tool using the @mcp.tool() decorator from FastMCP.@mcp.tool()
- main.py:9-10 (schema)Schema inferred from function signature (no inputs, str output) and docstring describing the tool's purpose and return value.def whoami() -> str: """Returns the username of the current system user as my identity."""
- main.py:2-2 (helper)Imports getpass module, used by the whoami handler to fetch the current username.import getpass