This feature (002-direct-db-access) enables scripts to query schedule data directly via SQL after loading XER files through MCP. Key additions: - spec.md: Feature specification with 3 user stories - plan.md: Implementation plan with constitution check - research.md: Technology decisions (SQLite file, WAL mode, atomic writes) - data-model.md: DatabaseInfo, SchemaInfo, TableInfo entities - contracts/mcp-tools.json: Extended load_xer schema, new get_database_info tool - quickstart.md: Usage examples for direct database access - tasks.md: 16 implementation tasks across 6 phases
169 lines
5.2 KiB
JSON
169 lines
5.2 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"title": "XER MCP Server Tools - Direct Database Access Extension",
|
|
"description": "MCP tool definitions for persistent database access",
|
|
"version": "0.2.0",
|
|
"tools": [
|
|
{
|
|
"name": "load_xer",
|
|
"description": "Load a Primavera P6 XER file and parse its schedule data. Optionally persist to a SQLite database file for direct script access.",
|
|
"inputSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"file_path": {
|
|
"type": "string",
|
|
"description": "Absolute path to the XER file"
|
|
},
|
|
"project_id": {
|
|
"type": "string",
|
|
"description": "Project ID to select (required for multi-project files)"
|
|
},
|
|
"db_path": {
|
|
"type": "string",
|
|
"description": "Path for persistent SQLite database file. If omitted, uses in-memory database. If empty string, auto-generates path from XER filename (same directory, .sqlite extension)."
|
|
}
|
|
},
|
|
"required": ["file_path"]
|
|
},
|
|
"outputSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": { "type": "boolean" },
|
|
"project": {
|
|
"type": "object",
|
|
"properties": {
|
|
"proj_id": { "type": "string" },
|
|
"proj_short_name": { "type": "string" },
|
|
"plan_start_date": { "type": "string", "format": "date-time" },
|
|
"plan_end_date": { "type": "string", "format": "date-time" }
|
|
}
|
|
},
|
|
"activity_count": { "type": "integer" },
|
|
"relationship_count": { "type": "integer" },
|
|
"database": { "$ref": "#/$defs/DatabaseInfo" },
|
|
"available_projects": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"proj_id": { "type": "string" },
|
|
"proj_short_name": { "type": "string" }
|
|
}
|
|
},
|
|
"description": "Only present for multi-project files without selection"
|
|
},
|
|
"warnings": {
|
|
"type": "array",
|
|
"items": { "type": "string" }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "get_database_info",
|
|
"description": "Get information about the currently loaded database including file path and schema. Use this to get connection details for direct SQL access.",
|
|
"inputSchema": {
|
|
"type": "object",
|
|
"properties": {}
|
|
},
|
|
"outputSchema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"database": { "$ref": "#/$defs/DatabaseInfo" },
|
|
"error": { "$ref": "#/$defs/Error" }
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"$defs": {
|
|
"DatabaseInfo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"db_path": {
|
|
"type": "string",
|
|
"description": "Absolute path to SQLite database file, or ':memory:' for in-memory"
|
|
},
|
|
"is_persistent": {
|
|
"type": "boolean",
|
|
"description": "True if file-based database, false if in-memory"
|
|
},
|
|
"source_file": {
|
|
"type": "string",
|
|
"description": "Path to XER file that was loaded"
|
|
},
|
|
"loaded_at": {
|
|
"type": "string",
|
|
"format": "date-time",
|
|
"description": "When data was loaded"
|
|
},
|
|
"schema": { "$ref": "#/$defs/SchemaInfo" }
|
|
},
|
|
"required": ["db_path", "is_persistent", "loaded_at", "schema"]
|
|
},
|
|
"SchemaInfo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"version": {
|
|
"type": "string",
|
|
"description": "Schema version"
|
|
},
|
|
"tables": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/TableInfo" }
|
|
}
|
|
},
|
|
"required": ["version", "tables"]
|
|
},
|
|
"TableInfo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"columns": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/ColumnInfo" }
|
|
},
|
|
"primary_key": {
|
|
"type": "array",
|
|
"items": { "type": "string" }
|
|
},
|
|
"foreign_keys": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/ForeignKeyInfo" }
|
|
},
|
|
"row_count": { "type": "integer" }
|
|
},
|
|
"required": ["name", "columns", "primary_key", "row_count"]
|
|
},
|
|
"ColumnInfo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"type": { "type": "string" },
|
|
"nullable": { "type": "boolean" },
|
|
"default": { "type": "string" }
|
|
},
|
|
"required": ["name", "type", "nullable"]
|
|
},
|
|
"ForeignKeyInfo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"column": { "type": "string" },
|
|
"references_table": { "type": "string" },
|
|
"references_column": { "type": "string" }
|
|
},
|
|
"required": ["column", "references_table", "references_column"]
|
|
},
|
|
"Error": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "string",
|
|
"enum": ["NO_FILE_LOADED", "DATABASE_ERROR", "FILE_NOT_WRITABLE", "DISK_FULL"]
|
|
},
|
|
"message": { "type": "string" }
|
|
},
|
|
"required": ["code", "message"]
|
|
}
|
|
}
|
|
}
|