Skip to main content
Glama
aliyun

AlibabaCloud DevOps MCP Server

Official
by aliyun

get_organization_department_ancestors

Retrieve the hierarchical chain of parent departments for a specific department within an Alibaba Cloud DevOps organization to understand reporting structures and access controls.

Instructions

Get the ancestors of a department in an organization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationIdYesOrganization ID
idYesDepartment ID

Implementation Reference

  • MCP tool handler for get_organization_department_ancestors: parses input args using schema, calls the core helper function, and formats response as JSON text.
    case "get_organization_department_ancestors": {
      const args = types.GetOrganizationDepartmentAncestorsSchema.parse(request.params.arguments);
      const ancestors = await organization.getOrganizationDepartmentAncestorsFunc(
        args.organizationId,
        args.id
      );
      return {
        content: [{ type: "text", text: JSON.stringify(ancestors, null, 2) }],
      };
    }
  • Zod schema defining input parameters: organizationId and department id.
    export const GetOrganizationDepartmentAncestorsSchema = z.object({
      organizationId: z.string().describe("Organization ID"),
      id: z.string().describe("Department ID"),
    });
  • Tool registration entry with name, description, and JSON schema derived from Zod schema.
    {
      name: "get_organization_department_ancestors",
      description: "Get the ancestors of a department in an organization",
      inputSchema: zodToJsonSchema(types.GetOrganizationDepartmentAncestorsSchema),
    },
  • Helper function that constructs API URL, makes GET request to fetch department ancestors, and parses response using schema.
    export async function getOrganizationDepartmentAncestorsFunc(
        organizationId: string,
        id: string): Promise<z.infer<typeof OrganizationDepartmentsSchema>>  {
      const url = `/oapi/v1/platform/organizations/${organizationId}/departments/${id}/ancestors`;
      const response = await yunxiaoRequest(url, {
        method: "GET",
      })
      return OrganizationDepartmentsSchema.parse(response);
    };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aliyun/alibabacloud-devops-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server