get_user_organizations
Retrieve the list of organizations a user belongs to within Alibaba Cloud DevOps for managing projects, repositories, and workflows.
Instructions
Get the list of organizations the current user belongs to
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tool-handlers/base.ts:12-17 (handler)The switch case handler for the 'get_user_organizations' tool. It calls the supporting function getUserOrganizationsFunc() from the organization module and returns the result formatted as MCP tool response content.case "get_user_organizations": { const userOrgs = await organization.getUserOrganizationsFunc(); return { content: [{ type: "text", text: JSON.stringify(userOrgs, null, 2) }], }; }
- Zod schemas defining the structure of organization info and the array of user organizations (output validation for the tool).export const OrganizationInfoSchema = z.object({ id: z.string().optional().describe("Organization ID"), name: z.string().optional().describe("Organization name"), description: z.string().optional().describe("Organization description"), }); export const UserOrganizationsInfoSchema = z.array(OrganizationInfoSchema);
- tool-registry/base.ts:10-14 (registration)Tool registration entry defining name, description, and empty input schema for 'get_user_organizations' in the base tools registry.{ name: "get_user_organizations", description: "Get the list of organizations the current user belongs to", inputSchema: zodToJsonSchema(z.object({})), },
- The core helper function that performs the API request to fetch the user's organizations and validates the response using UserOrganizationsInfoSchema.export async function getUserOrganizationsFunc( ): Promise<z.infer<typeof UserOrganizationsInfoSchema>> { const url = "/oapi/v1/platform/organizations"; const response = await yunxiaoRequest(url, { method: "GET", }); if (!Array.isArray(response)) { return []; } return UserOrganizationsInfoSchema.parse(response); }