Implement complete MCP server for parsing Primavera P6 XER files and exposing schedule data through MCP tools. All 4 user stories complete. Tools implemented: - load_xer: Parse XER files into SQLite database - list_activities: Query activities with pagination and filtering - get_activity: Get activity details by ID - list_relationships: Query activity dependencies - get_predecessors/get_successors: Query activity relationships - get_project_summary: Project overview with counts - list_milestones: Query milestone activities - get_critical_path: Query driving path activities Features: - Tab-delimited XER format parsing with pluggable table handlers - In-memory SQLite database for fast queries - Pagination with 100-item default limit - Multi-project file support with project selection - ISO8601 date formatting - NO_FILE_LOADED error handling for all query tools Test coverage: 81 tests (contract, integration, unit)
27 lines
828 B
Python
27 lines
828 B
Python
"""PROJWBS table handler."""
|
|
|
|
from xer_mcp.parser.table_handlers.base import TableHandler
|
|
|
|
|
|
class ProjwbsHandler(TableHandler):
|
|
"""Handler for PROJWBS (WBS) table in XER files."""
|
|
|
|
@property
|
|
def table_name(self) -> str:
|
|
return "PROJWBS"
|
|
|
|
def parse_row(self, fields: list[str], values: list[str]) -> dict | None:
|
|
"""Parse a PROJWBS row."""
|
|
if len(values) < len(fields):
|
|
values = values + [""] * (len(fields) - len(values))
|
|
|
|
data = dict(zip(fields, values, strict=False))
|
|
|
|
return {
|
|
"wbs_id": data.get("wbs_id", ""),
|
|
"proj_id": data.get("proj_id", ""),
|
|
"parent_wbs_id": data.get("parent_wbs_id", ""),
|
|
"wbs_short_name": data.get("wbs_short_name", ""),
|
|
"wbs_name": data.get("wbs_name") or None,
|
|
}
|