getUserInfo
Retrieve detailed user information from the current operating environment to analyze system status or monitor active sessions.
Instructions
获取当前系统的用户信息
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"required": [],
"type": "object"
}
Implementation Reference
- src/index.ts:341-354 (handler)Handler for the getUserInfo tool. Retrieves current user information using os.userInfo(), temporary directory with os.tmpdir(), and home directory with os.homedir(). Returns the information as a JSON string in the tool response format.case "getUserInfo": { const userInfo = { userInfo: os.userInfo(), tmpdir: os.tmpdir(), homedir: os.homedir() }; return { content: [{ type: "text", text: JSON.stringify(userInfo, null, 2) }] }; }
- src/index.ts:64-72 (registration)Registration of the getUserInfo tool in the tools list returned by the ListToolsRequest handler. Includes the tool name, description, and input schema (empty object).{ name: "getUserInfo", description: "获取当前系统的用户信息", inputSchema: { type: "object", properties: {}, required: [] } },
- src/index.ts:67-71 (schema)Input schema for the getUserInfo tool, which is an empty object with no properties or required fields.inputSchema: { type: "object", properties: {}, required: [] }