get_organization_department_info
Retrieve department details within an organization on Alibaba Cloud DevOps platform using organization and department IDs.
Instructions
Get information about a department in an organization
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | Organization ID | |
| id | Yes | Department ID |
Implementation Reference
- tool-handlers/organization.ts:19-28 (handler)Tool handler that parses input arguments using the schema, calls the core getOrganizationDepartmentInfoFunc with organizationId and department id, and returns the result as JSON stringified text content.case "get_organization_department_info": { const args = types.GetOrganizationDepartmentInfoSchema.parse(request.params.arguments); const departmentInfo = await organization.getOrganizationDepartmentInfoFunc( args.organizationId, args.id ) return { content: [{ type: "text", text: JSON.stringify(departmentInfo, null, 2) }], }; }
- Zod schema defining the input parameters for the tool: organizationId (string) and id (department ID, string).export const GetOrganizationDepartmentInfoSchema = z.object({ organizationId: z.string().describe("Organization ID"), id: z.string().describe("Department ID"), });
- tool-registry/organization.ts:26-30 (registration)Registers the tool in the registry with name, description, and input schema derived from the Zod schema.{ name: "get_organization_department_info", description: "Get information about a department in an organization", inputSchema: zodToJsonSchema(types.GetOrganizationDepartmentInfoSchema), },
- Core helper function that constructs the API URL using organizationId and department id, performs a GET request via yunxiaoRequest, and parses the response using DepartmentInfoSchema.export async function getOrganizationDepartmentInfoFunc( organizationId: string, id: string ): Promise<z.infer<typeof DepartmentInfoSchema>> { const url = `/oapi/v1/platform/organizations/${organizationId}/departments/${id}`; const response = await yunxiaoRequest(url, { method: "GET", }); return DepartmentInfoSchema.parse(response); }