get_current_organization_info
Retrieve current user and organization details from Alibaba Cloud DevOps platform using authentication tokens for identity verification and access control.
Instructions
Get information about the current user and organization based on the token. In the absence of an explicitly specified organization ID, this result will take precedence.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tool-handlers/base.ts:5-10 (handler)Tool handler case that executes get_current_organization_info by calling the core function and returning formatted JSON response.case "get_current_organization_info": { const currentOrgInfo = await organization.getCurrentOrganizationInfoFunc(); return { content: [{ type: "text", text: JSON.stringify(currentOrgInfo, null, 2) }], }; }
- Core helper function that performs the API request to fetch current organization info, maps the response, and validates with schema.export async function getCurrentOrganizationInfoFunc( ): Promise<z.infer<typeof CurrentOrganizationInfoSchema>> { const url = "/oapi/v1/platform/user"; const response = await yunxiaoRequest(url, { method: "GET", }); const responseData = response as { lastOrganization?: string; id?: string; name?: string; }; const mappedResponse = { lastOrganization: responseData.lastOrganization, // Organization ID userId: responseData.id, // Map API's "id" to userId userName: responseData.name // Map API's "name" to userName }; return CurrentOrganizationInfoSchema.parse(mappedResponse); }
- Zod schema defining the output structure for current organization information.export const CurrentOrganizationInfoSchema = z.object({ lastOrganization: z.string().optional().describe("Organization ID of the most recent login, used for subsequent API calls, should be used as organizationId"), userId: z.string().optional().describe("Current user ID, not the organization ID"), userName: z.string().optional().describe("Current user name"), });
- tool-registry/base.ts:5-9 (registration)Tool registration defining name, description, and empty input schema (converted to JSON schema).{ name: "get_current_organization_info", description: "Get information about the current user and organization based on the token. In the absence of an explicitly specified organization ID, this result will take precedence.", inputSchema: zodToJsonSchema(z.object({})), },