pyp6xer_list_calendars
Retrieve all calendars from a loaded P6 XER file, including name, type (global/project/resource), hours per day/week/year, and project default status.
Instructions
List all calendars defined in the XER file.
Returns calendar name, type (global/project/resource), hours per day/week/year, and whether it is the project default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cache_key | No | Cache key identifying the loaded XER file (set when calling pyp6xer_load_file) | default |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:688-689 (registration)The tool 'pyp6xer_list_calendars' is registered as an MCP tool via the @mcp.tool decorator on line 688.
@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False, idempotentHint=True, openWorldHint=False)) def pyp6xer_list_calendars( - server.py:689-711 (handler)The handler function for pyp6xer_list_calendars that lists all calendars from the XER file, returning calendar name, type, hours per day/week/year, and whether it's the project default.
def pyp6xer_list_calendars( cache_key: Annotated[str, Field(description="Cache key identifying the loaded XER file (set when calling pyp6xer_load_file)")] = "default", ctx: Context = None, ) -> str: """List all calendars defined in the XER file. Returns calendar name, type (global/project/resource), hours per day/week/year, and whether it is the project default. """ xer = _get_xer(ctx, cache_key) cals = [] for cal in xer.calendars.values(): cals.append({ "clndr_id": cal.uid, "name": cal.name, "type": cal.type.name if hasattr(cal, "type") else "", "is_default": getattr(cal, "is_default", False), "day_hr_cnt": getattr(cal, "day_hr_cnt", 8), "week_hr_cnt": getattr(cal, "week_hr_cnt", 40), "year_hr_cnt": getattr(cal, "year_hr_cnt", 2080), }) return json.dumps({"total": len(cals), "calendars": cals}, indent=2) - server.py:688-711 (schema)Input/output schema is defined via function signature and decorator annotations. Takes a cache_key string parameter (default 'default') and returns a JSON string with total calendar count and calendar details.
@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False, idempotentHint=True, openWorldHint=False)) def pyp6xer_list_calendars( cache_key: Annotated[str, Field(description="Cache key identifying the loaded XER file (set when calling pyp6xer_load_file)")] = "default", ctx: Context = None, ) -> str: """List all calendars defined in the XER file. Returns calendar name, type (global/project/resource), hours per day/week/year, and whether it is the project default. """ xer = _get_xer(ctx, cache_key) cals = [] for cal in xer.calendars.values(): cals.append({ "clndr_id": cal.uid, "name": cal.name, "type": cal.type.name if hasattr(cal, "type") else "", "is_default": getattr(cal, "is_default", False), "day_hr_cnt": getattr(cal, "day_hr_cnt", 8), "week_hr_cnt": getattr(cal, "week_hr_cnt", 40), "year_hr_cnt": getattr(cal, "year_hr_cnt", 2080), }) return json.dumps({"total": len(cals), "calendars": cals}, indent=2)