list_organization_roles
Retrieve available roles within an Alibaba Cloud DevOps organization to manage user permissions and access control for projects and resources.
Instructions
[Organization Management] List organization roles
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | Organization ID |
Implementation Reference
- tool-handlers/organization.ts:90-96 (handler)Tool handler implementation that parses input arguments using the schema, calls the listOrganizationRolesFunc helper, and returns the roles as a JSON string in the tool response format.case "list_organization_roles": { const args = types.ListOrganizationRolesSchema.parse(request.params.arguments); const roles = await organization.listOrganizationRolesFunc(args.organizationId); return { content: [{ type: "text", text: JSON.stringify(roles, null, 2)}] } }
- tool-registry/organization.ts:56-60 (registration)Tool registration entry defining the name, description, and input schema for the list_organization_roles tool.{ name: "list_organization_roles", description: "[Organization Management] List organization roles", inputSchema: zodToJsonSchema(types.ListOrganizationRolesSchema), },
- Zod schema definition for the input parameters of the list_organization_roles tool, requiring organizationId.export const ListOrganizationRolesSchema = z.object({ organizationId: z.string().describe("Organization ID") });
- Core helper function that makes the API request to fetch organization roles and parses the response using the OrganizationRole schema.export async function listOrganizationRolesFunc( organizationId: string ): Promise<z.infer<typeof OrganizationRole>> { const url = `/oapi/v1/platform/organizations/${organizationId}/roles`; const response = await yunxiaoRequest(url, { method: "GET" }); return OrganizationRole.parse(response); }
- Zod schema definitions for the organization role objects and the array of roles used for output validation in the helper function.export const OrganizationRoleSchema = z.object({ id: z.string().describe("Role ID"), name: z.string().describe("Role name"), organizationId: z.string().describe("Organization ID"), permissions: z.array(z.string()).describe("Role permission list") }); export const OrganizationRole = z.array(OrganizationRoleSchema);