get_current_user
Retrieve current user information from Alibaba Cloud DevOps platform using authentication token to identify active sessions and access permissions.
Instructions
Get information about the current user based on the token. In the absence of an explicitly specified user ID, this result will take precedence.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tool-handlers/base.ts:19-24 (handler)Handler for the 'get_current_user' tool that invokes getCurrentUserFunc and formats the response as JSON.case "get_current_user": { const currentUserInfo = await organization.getCurrentUserFunc(); return { content: [{ type: "text", text: JSON.stringify(currentUserInfo, null, 2) }], }; }
- Zod schema defining the structure of the current user information returned by the tool.export const CurrentUserSchema = z.object({ id: z.string().nullable().optional().describe("User ID"), name: z.string().optional().describe("Display name"), email: z.string().optional().describe("Email address"), username: z.string().optional().describe("Login account name"), lastOrganization: z.string().optional().describe("Last login organization ID"), staffId: z.string().optional().describe("Staff ID"), nickName: z.string().optional().describe("Nickname"), sysDeptIds: z.array(z.string()).optional().describe("Department IDs"), createdAt: z.string().optional().describe("Creation time (ISO 8601格式)"), deletedAt: z.string().optional().describe("Deletion time (ISO 8601格式)") });
- Core implementation function that fetches current user data from the API endpoint '/oapi/v1/platform/user' and validates it using CurrentUserSchema.export async function getCurrentUserFunc(): Promise<z.infer<typeof CurrentUserSchema>> { const url = "/oapi/v1/platform/user"; const response = await yunxiaoRequest(url, { method: "GET", }); return CurrentUserSchema.parse(response); }
- tool-registry/base.ts:15-19 (registration)Tool registration defining the name, description, and empty input schema for 'get_current_user'.{ name: "get_current_user", description: "Get information about the current user based on the token. In the absence of an explicitly specified user ID, this result will take precedence.", inputSchema: zodToJsonSchema(z.object({})), }
- tool-registry/organization.ts:16-20 (registration)Additional tool registration for 'get_current_user' in organization-specific registry.{ name: "get_current_user", description: "Get information about the current user based on the token. In the absence of an explicitly specified user ID, this result will take precedence.", inputSchema: zodToJsonSchema(z.object({})), },