Skip to content

Open-source Revit MCP server: let Claude and other AI assistants read and edit BIM models, with human approval on every change.

Add villa MCP test scripts and command documentation

sammohammad578854605e2a2ee
diff --git a/VILLA_TEST_COMMANDS.md b/VILLA_TEST_COMMANDS.md
new file mode 100644
index 0000000..7e84a33
--- /dev/null
+++ b/VILLA_TEST_COMMANDS.md
@@ -0,0 +1,677 @@
+# Villa Building Test - MCP Commands
+
+**Date:** 2026-01-08
+**Goal:** Test all available MCP tools by building a complete villa
+
+---
+
+## Test Setup
+
+### Step 1: Create New Project
+1. In Revit: File > New > Architectural Template
+2. Save as "TestVilla_2026-01-08.rvt"
+
+### Step 2: Test Document Tools
+Use Claude Desktop or MCP client to connect and run:
+
+```json
+// Test 1: List open documents
+{
+ "tool": "list_documents"
+}
+
+// Test 2: Get active document info
+{
+ "tool": "get_active_document"
+}
+
+// Test 3: Get document details
+{
+ "tool": "get_document_info"
+}
+```
+
+**Expected Result:** Should return your TestVilla document information
+
+---
+
+## Phase 1: Create Levels
+
+### Test Level Tools
+
+```json
+// Test 4: List existing levels
+{
+ "tool": "list_levels"
+}
+
+// Test 5: Create First Floor level
+{
+ "tool": "create_level",
+ "arguments": {
+ "name": "First Floor",
+ "elevation": 3500
+ }
+}
+
+// Test 6: Create Roof level
+{
+ "tool": "create_level",
+ "arguments": {
+ "name": "Roof",
+ "elevation": 7000
+ }
+}
+
+// Test 7: List levels again to verify
+{
+ "tool": "list_levels"
+}
+```
+
+**Expected Result:**
+- Should see Level 1, Level 2 (existing)
+- New levels: First Floor (3500mm), Roof (7000mm)
+
+---
+
+## Phase 2: Create External Walls
+
+### Test Wall Creation Tools
+
+```json
+// Test 8: List available wall types
+{
+ "tool": "list_wall_types"
+}
+
+// Test 9: Get all elements to understand structure
+{
+ "tool": "get_all_elements"
+}
+
+// Test 10: Create South Wall (10m width)
+{
+ "tool": "create_wall",
+ "arguments": {
+ "startPoint": [0, 0, 0],
+ "endPoint": [10000, 0, 0],
+ "height": 2800,
+ "levelName": "Level 1",
+ "wallTypeName": "Generic - 200mm"
+ }
+}
+
+// Test 11: Create East Wall (12m length)
+{
+ "tool": "create_wall",
+ "arguments": {
+ "startPoint": [10000, 0, 0],
+ "endPoint": [10000, 12000, 0],
+ "height": 2800,
+ "levelName": "Level 1",
+ "wallTypeName": "Generic - 200mm"
+ }
+}
+
+// Test 12: Create North Wall
+{
+ "tool": "create_wall",
+ "arguments": {
+ "startPoint": [10000, 12000, 0],
+ "endPoint": [0, 12000, 0],
+ "height": 2800,
+ "levelName": "Level 1",
+ "wallTypeName": "Generic - 200mm"
+ }
+}
+
+// Test 13: Create West Wall
+{
+ "tool": "create_wall",
+ "arguments": {
+ "startPoint": [0, 12000, 0],
+ "endPoint": [0, 0, 0],
+ "height": 2800,
+ "levelName": "Level 1",
+ "wallTypeName": "Generic - 200mm"
+ }
+}
+```
+
+**Expected Result:** 4 walls forming 10m x 12m rectangle
+
+---
+
+## Phase 3: Create Internal Walls
+
+### Test Interior Partition Walls
+
+```json
+// Test 14: Create hallway wall
+{
+ "tool": "create_wall",
+ "arguments": {
+ "startPoint": [3000, 0, 0],
+ "endPoint": [3000, 12000, 0],
+ "height": 2800,
+ "levelName": "Level 1",
+ "wallTypeName": "Generic - 100mm"
+ }
+}
+
+// Test 15: Create bedroom divider
+{
+ "tool": "create_wall",
+ "arguments": {
+ "startPoint": [3000, 6000, 0],
+ "endPoint": [10000, 6000, 0],
+ "height": 2800,
+ "levelName": "Level 1",
+ "wallTypeName": "Generic - 100mm"
+ }
+}
+
+// Test 16: Create bathroom wall
+{
+ "tool": "create_wall",
+ "arguments": {
+ "startPoint": [7000, 0, 0],
+ "endPoint": [7000, 6000, 0],
+ "height": 2800,
+ "levelName": "Level 1",
+ "wallTypeName": "Generic - 100mm"
+ }
+}
+```
+
+**Expected Result:** Interior walls dividing spaces
+
+---
+
+## Phase 4: Query Walls
+
+### Test Filtering Tools
+
+```json
+// Test 17: Get all walls
+{
+ "tool": "get_elements_by_category",
+ "arguments": {
+ "category": "Walls"
+ }
+}
+
+// Test 18: Get all elements (should include walls)
+{
+ "tool": "get_all_elements"
+}
+
+// Test 19: Find specific wall by ID (use ID from previous query)
+{
+ "tool": "get_element_by_id",
+ "arguments": {
+ "elementId": "12345" // Replace with actual ID
+ }
+}
+```
+
+**Expected Result:** Should return all created walls with details
+
+---
+
+## Phase 5: Create Floors
+
+### Test Floor Creation
+
+```json
+// Test 20: List available floor types
+{
+ "tool": "list_floor_types"
+}
+
+// Test 21: Create ground floor slab
+{
+ "tool": "create_floor",
+ "arguments": {
+ "boundary": [
+ [0, 0, 0],
+ [10000, 0, 0],
+ [10000, 12000, 0],
+ [0, 12000, 0]
+ ],
+ "levelName": "Level 1",
+ "floorTypeName": "Generic - 150mm"
+ }
+}
+
+// Test 22: Create first floor slab
+{
+ "tool": "create_floor",
+ "arguments": {
+ "boundary": [
+ [0, 0, 3500],
+ [10000, 0, 3500],
+ [10000, 12000, 3500],
+ [0, 12000, 3500]
+ ],
+ "levelName": "First Floor",
+ "floorTypeName": "Generic - 150mm"
+ }
+}
+```
+
+**Expected Result:** 2 floor slabs created
+
+---
+
+## Phase 6: Place Doors
+
+### Test Family Placement
+
+```json
+// Test 23: List available families
+{
+ "tool": "list_families"
+}
+
+// Test 24: List door families specifically
+{
+ "tool": "list_family_symbols",
+ "arguments": {
+ "familyName": "Single-Flush" // Or whatever door family is available
+ }
+}
+
+// Test 25: Place front door in south wall
+{
+ "tool": "place_family_instance",
+ "arguments": {
+ "familyName": "Single-Flush",
+ "symbolName": "0915 x 2134mm",
+ "location": [5000, 0, 0],
+ "levelName": "Level 1"
+ }
+}
+
+// Test 26: Place bedroom door 1
+{
+ "tool": "place_family_instance",
+ "arguments": {
+ "familyName": "Single-Flush",
+ "symbolName": "0915 x 2134mm",
+ "location": [3000, 3000, 0],
+ "levelName": "Level 1"
+ }
+}
+
+// Test 27: Place bedroom door 2
+{
+ "tool": "place_family_instance",
+ "arguments": {
+ "familyName": "Single-Flush",
+ "symbolName": "0915 x 2134mm",
+ "location": [3000, 9000, 0],
+ "levelName": "Level 1"
+ }
+}
+
+// Test 28: Place bathroom door
+{
+ "tool": "place_family_instance",
+ "arguments": {
+ "familyName": "Single-Flush",
+ "symbolName": "0762 x 2134mm",
+ "location": [7000, 3000, 0],
+ "levelName": "Level 1"
+ }
+}
+```
+
+**Expected Result:** 4 doors placed in walls
+
+---
+
+## Phase 7: Place Windows
+
+### Test Window Placement
+
+```json
+// Test 29: List window families
+{
+ "tool": "list_family_symbols",
+ "arguments": {
+ "familyName": "Fixed" // Or whatever window family is available
+ }
+}
+
+// Test 30: Place living room window 1
+{
+ "tool": "place_family_instance",
+ "arguments": {
+ "familyName": "Fixed",
+ "symbolName": "1800 x 1200mm",
+ "location": [1500, 0, 1000],
+ "levelName": "Level 1"
+ }
+}
+
+// Test 31: Place living room window 2
+{
+ "tool": "place_family_instance",
+ "arguments": {
+ "familyName": "Fixed",
+ "symbolName": "1800 x 1200mm",
+ "location": [8500, 0, 1000],
+ "levelName": "Level 1"
+ }
+}
+
+// Test 32: Place bedroom 1 window
+{
+ "tool": "place_family_instance",
+ "arguments": {
+ "familyName": "Fixed",
+ "symbolName": "1200 x 1200mm",
+ "location": [10000, 3000, 1000],
+ "levelName": "Level 1"
+ }
+}
+
+// Test 33: Place bedroom 2 window
+{
+ "tool": "place_family_instance",
+ "arguments": {
+ "familyName": "Fixed",
+ "symbolName": "1200 x 1200mm",
+ "location": [10000, 9000, 1000],
+ "levelName": "Level 1"
+ }
+}
+```
+
+**Expected Result:** 4 windows placed in exterior walls
+
+---
+
+## Phase 8: Create Rooms
+
+### Test Room Creation
+
+```json
+// Test 34: Create Living Room
+{
+ "tool": "create_room",
+ "arguments": {
+ "location": [1500, 6000, 0],
+ "levelName": "Level 1",
+ "name": "Living Room",
+ "number": "101"
+ }
+}
+
+// Test 35: Create Bedroom 1
+{
+ "tool": "create_room",
+ "arguments": {
+ "location": [6500, 3000, 0],
+ "levelName": "Level 1",
+ "name": "Bedroom 1",
+ "number": "102"
+ }
+}
+
+// Test 36: Create Bedroom 2
+{
+ "tool": "create_room",
+ "arguments": {
+ "location": [6500, 9000, 0],
+ "levelName": "Level 1",
+ "name": "Bedroom 2",
+ "number": "103"
+ }
+}
+
+// Test 37: Create Bathroom
+{
+ "tool": "create_room",
+ "arguments": {
+ "location": [8500, 3000, 0],
+ "levelName": "Level 1",
+ "name": "Bathroom",
+ "number": "104"
+ }
+}
+
+// Test 38: List all rooms
+{
+ "tool": "list_rooms"
+}
+
+// Test 39: Get room properties
+{
+ "tool": "room_properties",
+ "arguments": {
+ "roomId": "12345" // Replace with actual room ID
+ }
+}
+```
+
+**Expected Result:** 4 rooms created with names and numbers
+
+---
+
+## Phase 9: Test Parameters
+
+### Test Parameter Modification
+
+```json
+// Test 40: Get wall parameters (use wall ID from earlier)
+{
+ "tool": "get_parameters",
+ "arguments": {
+ "elementId": "12345" // Replace with actual wall ID
+ }
+}
+
+// Test 41: Set wall height parameter
+{
+ "tool": "set_parameter",
+ "arguments": {
+ "elementId": "12345",
+ "parameterName": "Unconnected Height",
+ "value": 3000
+ }
+}
+
+// Test 42: Get room parameters
+{
+ "tool": "get_parameters",
+ "arguments": {
+ "elementId": "67890" // Replace with actual room ID
+ }
+}
+
+// Test 43: Set room name
+{
+ "tool": "set_parameter",
+ "arguments": {
+ "elementId": "67890",
+ "parameterName": "Name",
+ "value": "Master Bedroom"
+ }
+}
+```
+
+**Expected Result:** Parameters modified successfully
+
+---
+
+## Phase 10: Test Geometry & Location
+
+### Test Geometry Tools
+
+```json
+// Test 44: Get wall geometry
+{
+ "tool": "get_geometry",
+ "arguments": {
+ "elementId": "12345" // Replace with wall ID
+ }
+}
+
+// Test 45: Get wall location
+{
+ "tool": "get_location",
+ "arguments": {
+ "elementId": "12345"
+ }
+}
+
+// Test 46: Move a door
+{
+ "tool": "move_element",
+ "arguments": {
+ "elementId": "11111", // Replace with door ID
+ "translation": [500, 0, 0] // Move 500mm in X direction
+ }
+}
+```
+
+**Expected Result:** Geometry data returned, element moved
+
+---
+
+## Phase 11: Test Materials
+
+### Test Material Assignment
+
+```json
+// Test 47: List available materials
+{
+ "tool": "list_materials"
+}
+
+// Test 48: Assign material to wall
+{
+ "tool": "assign_material",
+ "arguments": {
+ "elementId": "12345",
+ "materialName": "Concrete - Cast-in-Place Concrete"
+ }
+}
+```
+
+**Expected Result:** Material assigned to wall
+
+---
+
+## Phase 12: Advanced Queries
+
+### Test Filtering & Search
+
+```json
+// Test 49: Get all doors
+{
+ "tool": "get_elements_by_category",
+ "arguments": {
+ "category": "Doors"
+ }
+}
+
+// Test 50: Get all windows
+{
+ "tool": "get_elements_by_category",
+ "arguments": {
+ "category": "Windows"
+ }
+}
+
+// Test 51: Get all floors
+{
+ "tool": "get_elements_by_category",
+ "arguments": {
+ "category": "Floors"
+ }
+}
+
+// Test 52: Find elements (search)
+{
+ "tool": "find_elements",
+ "arguments": {
+ "searchTerm": "Living"
+ }
+}
+```
+
+**Expected Result:** Filtered element lists returned
+
+---
+
+## Phase 13: Save & Document
+
+### Final Tests
+
+```json
+// Test 53: Save document
+{
+ "tool": "save_document"
+}
+
+// Test 54: Get final document info
+{
+ "tool": "get_document_info"
+}
+
+// Test 55: Get element count summary
+{
+ "tool": "get_all_elements"
+}
+```
+
+**Expected Result:** Document saved, final summary
+
+---
+
+## Results Checklist
+
+### Tools Tested:
+- [ ] Document tools (list_documents, get_active_document, get_document_info)
+- [ ] Level tools (list_levels, create_level)
+- [ ] Wall tools (list_wall_types, create_wall, get_elements_by_category)
+- [ ] Floor tools (list_floor_types, create_floor)
+- [ ] Family tools (list_families, list_family_symbols, place_family_instance)
+- [ ] Room tools (create_room, list_rooms, room_properties)
+- [ ] Parameter tools (get_parameters, set_parameter)
+- [ ] Geometry tools (get_geometry, get_location, move_element)
+- [ ] Material tools (list_materials, assign_material)
+- [ ] Query tools (find_elements, get_element_by_id, get_all_elements)
+- [ ] Save tools (save_document)
+
+### Villa Components Created:
+- [ ] 3 Levels (Level 1, First Floor, Roof)
+- [ ] 7 Walls (4 external + 3 internal)
+- [ ] 2 Floor slabs
+- [ ] 4 Doors
+- [ ] 4 Windows
+- [ ] 4 Rooms with names
+
+### Issues Found:
+*(Document any errors or problems below)*
+
+---
+
+## Success Criteria
+
+βœ… **Full Success:** All 55 tests pass, complete villa created
+⚠️ **Partial Success:** 80%+ tests pass, most features work
+❌ **Failure:** <80% tests pass, major features broken
+
+**Total Tests: 55**
+**Tests Passed: ___**
+**Tests Failed: ___**
+**Success Rate: ___%**
+
+---
+
+**Ready to start testing! Use Claude Desktop or your MCP client to run these commands sequentially.**
diff --git a/test_villa.py b/test_villa.py
new file mode 100644
index 0000000..901f508
--- /dev/null
+++ b/test_villa.py
@@ -0,0 +1,271 @@
+#!/usr/bin/env python3
+"""
+Villa Building Test Script
+Tests all MCP tools by building a complete villa in Revit
+"""
+
+import requests
+import json
+import time
+from typing import Dict, Any, List
+
+BRIDGE_URL = "http://localhost:3000"
+TEST_RESULTS = []
+
+
+class VillaBuilder:
+ def __init__(self, bridge_url: str = BRIDGE_URL):
+ self.bridge_url = bridge_url
+ self.test_count = 0
+ self.pass_count = 0
+ self.fail_count = 0
+
+ def call_tool(self, tool: str, payload: Dict[str, Any] = None) -> Dict[str, Any]:
+ """Call a Revit tool via the bridge"""
+ self.test_count += 1
+ test_num = self.test_count
+
+ try:
+ print(f"\n{'='*60}")
+ print(f"Test #{test_num}: {tool}")
+ print(f"{'='*60}")
+
+ if payload:
+ print(f"Payload: {json.dumps(payload, indent=2)}")
+
+ response = requests.post(
+ f"{self.bridge_url}/execute",
+ json={"tool": tool, "payload": payload or {}},
+ timeout=30
+ )
+
+ result = response.json()
+
+ if response.status_code == 200:
+ print(f"βœ… PASS - Status: {response.status_code}")
+ print(f"Response: {json.dumps(result, indent=2)[:500]}")
+ self.pass_count += 1
+ TEST_RESULTS.append({"test": test_num, "tool": tool, "status": "PASS", "result": result})
+ return result
+ else:
+ print(f"❌ FAIL - Status: {response.status_code}")
+ print(f"Error: {result}")
+ self.fail_count += 1
+ TEST_RESULTS.append({"test": test_num, "tool": tool, "status": "FAIL", "error": result})
+ return None
+
+ except Exception as e:
+ print(f"❌ EXCEPTION - {str(e)}")
+ self.fail_count += 1
+ TEST_RESULTS.append({"test": test_num, "tool": tool, "status": "EXCEPTION", "error": str(e)})
+ return None
+
+ def print_summary(self):
+ """Print test summary"""
+ print(f"\n\n{'='*60}")
+ print("TEST SUMMARY")
+ print(f"{'='*60}")
+ print(f"Total Tests: {self.test_count}")
+ print(f"βœ… Passed: {self.pass_count}")
+ print(f"❌ Failed: {self.fail_count}")
+ print(f"Success Rate: {(self.pass_count / self.test_count * 100):.1f}%")
+ print(f"{'='*60}\n")
+
+
+def main():
+ print("""
+==============================================================
+ REVIT MCP - VILLA BUILDING TEST SUITE
+
+ Testing all available tools by building a complete
+ 10m x 12m villa with rooms, doors, and windows
+==============================================================
+ """)
+
+ builder = VillaBuilder()
+
+ # Phase 1: Server Health Check
+ print("\nπŸ₯ PHASE 1: Server Health Check")
+ print("-" * 60)
+ builder.call_tool("revit.health")
+
+ # Phase 2: Document Setup
+ print("\nπŸ“„ PHASE 2: Document Setup")
+ print("-" * 60)
+ builder.call_tool("revit.get_document_info")
+
+ # Phase 3: Level Management
+ print("\nπŸ“ PHASE 3: Level Management")
+ print("-" * 60)
+ levels_result = builder.call_tool("revit.list_levels")
+
+ builder.call_tool("revit.create_level", {
+ "name": "First Floor",
+ "elevation": 3500
+ })
+
+ builder.call_tool("revit.create_level", {
+ "name": "Roof",
+ "elevation": 7000
+ })
+
+ builder.call_tool("revit.list_levels")
+
+ # Phase 4: External Walls (10m x 12m rectangle)
+ print("\n🧱 PHASE 4: Create External Walls")
+ print("-" * 60)
+
+ # South wall (10m width along X)
+ builder.call_tool("revit.create_wall", {
+ "start": [0, 0, 0],
+ "end": [10000, 0, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # East wall (12m length along Y)
+ builder.call_tool("revit.create_wall", {
+ "start": [10000, 0, 0],
+ "end": [10000, 12000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # North wall
+ builder.call_tool("revit.create_wall", {
+ "start": [10000, 12000, 0],
+ "end": [0, 12000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # West wall
+ builder.call_tool("revit.create_wall", {
+ "start": [0, 12000, 0],
+ "end": [0, 0, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # Phase 5: Internal Walls
+ print("\n🏠 PHASE 5: Create Internal Walls")
+ print("-" * 60)
+
+ # Hallway wall (divides living area from bedrooms)
+ builder.call_tool("revit.create_wall", {
+ "start": [3000, 0, 0],
+ "end": [3000, 12000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # Bedroom divider
+ builder.call_tool("revit.create_wall", {
+ "start": [3000, 6000, 0],
+ "end": [10000, 6000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # Bathroom wall
+ builder.call_tool("revit.create_wall", {
+ "start": [7000, 0, 0],
+ "end": [7000, 6000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # Phase 6: Query Elements
+ print("\nπŸ” PHASE 6: Query Created Elements")
+ print("-" * 60)
+ builder.call_tool("revit.list_elements_by_category", {"category": "Walls"})
+
+ # Phase 7: Floors
+ print("\nπŸ—οΈ PHASE 7: Create Floor Slabs")
+ print("-" * 60)
+ builder.call_tool("revit.create_floor", {
+ "boundary": [
+ [0, 0, 0],
+ [10000, 0, 0],
+ [10000, 12000, 0],
+ [0, 12000, 0]
+ ],
+ "level_name": "Level 1"
+ })
+
+ # Phase 8: Families
+ print("\nπŸ‘ͺ PHASE 8: List Available Families")
+ print("-" * 60)
+ families_result = builder.call_tool("revit.list_families", {"category": "Doors"})
+ builder.call_tool("revit.list_families", {"category": "Windows"})
+
+ # Phase 9: Place Doors
+ print("\nπŸšͺ PHASE 9: Place Doors")
+ print("-" * 60)
+
+ # Front door
+ builder.call_tool("revit.place_door", {
+ "location": [5000, 0, 0],
+ "level_name": "Level 1"
+ })
+
+ # Phase 10: Place Windows
+ print("\nπŸͺŸ PHASE 10: Place Windows")
+ print("-" * 60)
+ builder.call_tool("revit.place_window", {
+ "location": [1500, 0, 1000],
+ "level_name": "Level 1"
+ })
+
+ builder.call_tool("revit.place_window", {
+ "location": [8500, 0, 1000],
+ "level_name": "Level 1"
+ })
+
+ # Phase 11: Rooms
+ print("\n🏑 PHASE 11: Create Rooms")
+ print("-" * 60)
+ builder.call_tool("revit.create_room", {
+ "location": [1500, 6000, 0],
+ "level_name": "Level 1",
+ "name": "Living Room",
+ "number": "101"
+ })
+
+ builder.call_tool("revit.create_room", {
+ "location": [6500, 3000, 0],
+ "level_name": "Level 1",
+ "name": "Bedroom 1",
+ "number": "102"
+ })
+
+ builder.call_tool("revit.create_room", {
+ "location": [6500, 9000, 0],
+ "level_name": "Level 1",
+ "name": "Bedroom 2",
+ "number": "103"
+ })
+
+ builder.call_tool("revit.create_room", {
+ "location": [8500, 3000, 0],
+ "level_name": "Level 1",
+ "name": "Bathroom",
+ "number": "104"
+ })
+
+ # Phase 12: Save
+ print("\nπŸ’Ύ PHASE 12: Save Document")
+ print("-" * 60)
+ builder.call_tool("revit.save_document")
+
+ # Final Summary
+ builder.print_summary()
+
+ # Save results to file
+ with open("villa_test_results.json", "w") as f:
+ json.dump(TEST_RESULTS, f, indent=2)
+ print("πŸ“Š Detailed results saved to: villa_test_results.json\n")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/test_villa_fixed.py b/test_villa_fixed.py
new file mode 100644
index 0000000..fa6b2ca
--- /dev/null
+++ b/test_villa_fixed.py
@@ -0,0 +1,271 @@
+#!/usr/bin/env python3
+"""
+Villa Building Test Script
+Tests all MCP tools by building a complete villa in Revit
+"""
+
+import requests
+import json
+import time
+from typing import Dict, Any, List
+
+BRIDGE_URL = "http://localhost:3000"
+TEST_RESULTS = []
+
+
+class VillaBuilder:
+ def __init__(self, bridge_url: str = BRIDGE_URL):
+ self.bridge_url = bridge_url
+ self.test_count = 0
+ self.pass_count = 0
+ self.fail_count = 0
+
+ def call_tool(self, tool: str, payload: Dict[str, Any] = None) -> Dict[str, Any]:
+ """Call a Revit tool via the bridge"""
+ self.test_count += 1
+ test_num = self.test_count
+
+ try:
+ print(f"\n{'='*60}")
+ print(f"Test #{test_num}: {tool}")
+ print(f"{'='*60}")
+
+ if payload:
+ print(f"Payload: {json.dumps(payload, indent=2)}")
+
+ response = requests.post(
+ f"{self.bridge_url}/execute",
+ json={"tool": tool, "payload": payload or {}},
+ timeout=30
+ )
+
+ result = response.json()
+
+ if response.status_code == 200:
+ print(f"PASS PASS - Status: {response.status_code}")
+ print(f"Response: {json.dumps(result, indent=2)[:500]}")
+ self.pass_count += 1
+ TEST_RESULTS.append({"test": test_num, "tool": tool, "status": "PASS", "result": result})
+ return result
+ else:
+ print(f"FAIL FAIL - Status: {response.status_code}")
+ print(f"Error: {result}")
+ self.fail_count += 1
+ TEST_RESULTS.append({"test": test_num, "tool": tool, "status": "FAIL", "error": result})
+ return None
+
+ except Exception as e:
+ print(f"FAIL EXCEPTION - {str(e)}")
+ self.fail_count += 1
+ TEST_RESULTS.append({"test": test_num, "tool": tool, "status": "EXCEPTION", "error": str(e)})
+ return None
+
+ def print_summary(self):
+ """Print test summary"""
+ print(f"\n\n{'='*60}")
+ print("TEST SUMMARY")
+ print(f"{'='*60}")
+ print(f"Total Tests: {self.test_count}")
+ print(f"PASS Passed: {self.pass_count}")
+ print(f"FAIL Failed: {self.fail_count}")
+ print(f"Success Rate: {(self.pass_count / self.test_count * 100):.1f}%")
+ print(f"{'='*60}\n")
+
+
+def main():
+ print("""
+==============================================================
+ REVIT MCP - VILLA BUILDING TEST SUITE
+
+ Testing all available tools by building a complete
+ 10m x 12m villa with rooms, doors, and windows
+==============================================================
+ """)
+
+ builder = VillaBuilder()
+
+ # Phase 1: Server Health Check
+ print("\nπŸ₯ PHASE 1: Server Health Check")
+ print("-" * 60)
+ builder.call_tool("revit.health")
+
+ # Phase 2: Document Setup
+ print("\nπŸ“„ PHASE 2: Document Setup")
+ print("-" * 60)
+ builder.call_tool("revit.get_document_info")
+
+ # Phase 3: Level Management
+ print("\nπŸ“ PHASE 3: Level Management")
+ print("-" * 60)
+ levels_result = builder.call_tool("revit.list_levels")
+
+ builder.call_tool("revit.create_level", {
+ "name": "First Floor",
+ "elevation": 3500
+ })
+
+ builder.call_tool("revit.create_level", {
+ "name": "Roof",
+ "elevation": 7000
+ })
+
+ builder.call_tool("revit.list_levels")
+
+ # Phase 4: External Walls (10m x 12m rectangle)
+ print("\n🧱 PHASE 4: Create External Walls")
+ print("-" * 60)
+
+ # South wall (10m width along X)
+ builder.call_tool("revit.create_wall", {
+ "start": [0, 0, 0],
+ "end": [10000, 0, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # East wall (12m length along Y)
+ builder.call_tool("revit.create_wall", {
+ "start": [10000, 0, 0],
+ "end": [10000, 12000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # North wall
+ builder.call_tool("revit.create_wall", {
+ "start": [10000, 12000, 0],
+ "end": [0, 12000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # West wall
+ builder.call_tool("revit.create_wall", {
+ "start": [0, 12000, 0],
+ "end": [0, 0, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # Phase 5: Internal Walls
+ print("\n🏠 PHASE 5: Create Internal Walls")
+ print("-" * 60)
+
+ # Hallway wall (divides living area from bedrooms)
+ builder.call_tool("revit.create_wall", {
+ "start": [3000, 0, 0],
+ "end": [3000, 12000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # Bedroom divider
+ builder.call_tool("revit.create_wall", {
+ "start": [3000, 6000, 0],
+ "end": [10000, 6000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # Bathroom wall
+ builder.call_tool("revit.create_wall", {
+ "start": [7000, 0, 0],
+ "end": [7000, 6000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+ })
+
+ # Phase 6: Query Elements
+ print("\nπŸ” PHASE 6: Query Created Elements")
+ print("-" * 60)
+ builder.call_tool("revit.list_elements_by_category", {"category": "Walls"})
+
+ # Phase 7: Floors
+ print("\nπŸ—οΈ PHASE 7: Create Floor Slabs")
+ print("-" * 60)
+ builder.call_tool("revit.create_floor", {
+ "boundary": [
+ [0, 0, 0],
+ [10000, 0, 0],
+ [10000, 12000, 0],
+ [0, 12000, 0]
+ ],
+ "level_name": "Level 1"
+ })
+
+ # Phase 8: Families
+ print("\nπŸ‘ͺ PHASE 8: List Available Families")
+ print("-" * 60)
+ families_result = builder.call_tool("revit.list_families", {"category": "Doors"})
+ builder.call_tool("revit.list_families", {"category": "Windows"})
+
+ # Phase 9: Place Doors
+ print("\nπŸšͺ PHASE 9: Place Doors")
+ print("-" * 60)
+
+ # Front door
+ builder.call_tool("revit.place_door", {
+ "location": [5000, 0, 0],
+ "level_name": "Level 1"
+ })
+
+ # Phase 10: Place Windows
+ print("\nπŸͺŸ PHASE 10: Place Windows")
+ print("-" * 60)
+ builder.call_tool("revit.place_window", {
+ "location": [1500, 0, 1000],
+ "level_name": "Level 1"
+ })
+
+ builder.call_tool("revit.place_window", {
+ "location": [8500, 0, 1000],
+ "level_name": "Level 1"
+ })
+
+ # Phase 11: Rooms
+ print("\n🏑 PHASE 11: Create Rooms")
+ print("-" * 60)
+ builder.call_tool("revit.create_room", {
+ "location": [1500, 6000, 0],
+ "level_name": "Level 1",
+ "name": "Living Room",
+ "number": "101"
+ })
+
+ builder.call_tool("revit.create_room", {
+ "location": [6500, 3000, 0],
+ "level_name": "Level 1",
+ "name": "Bedroom 1",
+ "number": "102"
+ })
+
+ builder.call_tool("revit.create_room", {
+ "location": [6500, 9000, 0],
+ "level_name": "Level 1",
+ "name": "Bedroom 2",
+ "number": "103"
+ })
+
+ builder.call_tool("revit.create_room", {
+ "location": [8500, 3000, 0],
+ "level_name": "Level 1",
+ "name": "Bathroom",
+ "number": "104"
+ })
+
+ # Phase 12: Save
+ print("\nπŸ’Ύ PHASE 12: Save Document")
+ print("-" * 60)
+ builder.call_tool("revit.save_document")
+
+ # Final Summary
+ builder.print_summary()
+
+ # Save results to file
+ with open("villa_test_results.json", "w") as f:
+ json.dump(TEST_RESULTS, f, indent=2)
+ print("πŸ“Š Detailed results saved to: villa_test_results.json\n")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/villa_test_simple.py b/villa_test_simple.py
new file mode 100644
index 0000000..21cf079
--- /dev/null
+++ b/villa_test_simple.py
@@ -0,0 +1,182 @@
+import requests
+import json
+
+URL = "http://localhost:3000/execute"
+
+def test(tool, payload={}):
+ req_id = f"test-{test.counter}"
+ test.counter += 1
+
+ print(f"\n[Test {test.counter}] {tool}")
+ print("-" * 60)
+
+ data = {"request_id": req_id, "tool": tool, "payload": payload}
+
+ try:
+ r = requests.post(URL, json=data, timeout=30)
+ result = r.json()
+
+ if result.get("Status") == "ok":
+ print(f"PASS - {tool}")
+ print(json.dumps(result.get("Result"), indent=2)[:500])
+ return result.get("Result")
+ else:
+ print(f"FAIL - {tool}")
+ print(f"Error: {result.get('Message')}")
+ return None
+ except Exception as e:
+ print(f"EXCEPTION - {str(e)}")
+ return None
+
+test.counter = 0
+
+print("\n" + "="*60)
+print("REVIT MCP - VILLA BUILDING TEST")
+print("="*60)
+
+# Test 1: Health
+test("revit.health")
+
+# Test 2: Document Info
+test("revit.get_document_info")
+
+# Test 3: List Levels
+levels = test("revit.list_levels")
+
+# Test 4: Create First Floor Level
+test("revit.create_level", {"name": "First Floor", "elevation": 3500})
+
+# Test 5: Create Roof Level
+test("revit.create_level", {"name": "Roof", "elevation": 7000})
+
+# Test 6: List Levels Again
+test("revit.list_levels")
+
+# Test 7-10: Create External Walls
+print("\n" + "="*60)
+print("Creating External Walls (10m x 12m)")
+print("="*60)
+
+# South wall
+test("revit.create_wall", {
+ "start": [0, 0, 0],
+ "end": [10000, 0, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+})
+
+# East wall
+test("revit.create_wall", {
+ "start": [10000, 0, 0],
+ "end": [10000, 12000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+})
+
+# North wall
+test("revit.create_wall", {
+ "start": [10000, 12000, 0],
+ "end": [0, 12000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+})
+
+# West wall
+test("revit.create_wall", {
+ "start": [0, 12000, 0],
+ "end": [0, 0, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+})
+
+# Test 11-13: Internal Walls
+print("\n" + "="*60)
+print("Creating Internal Walls")
+print("="*60)
+
+# Hallway wall
+test("revit.create_wall", {
+ "start": [3000, 0, 0],
+ "end": [3000, 12000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+})
+
+# Bedroom divider
+test("revit.create_wall", {
+ "start": [3000, 6000, 0],
+ "end": [10000, 6000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+})
+
+# Bathroom wall
+test("revit.create_wall", {
+ "start": [7000, 0, 0],
+ "end": [7000, 6000, 0],
+ "height": 2800,
+ "level_name": "Level 1"
+})
+
+# Test 14: List Walls
+print("\n" + "="*60)
+print("Query Created Walls")
+print("="*60)
+test("revit.list_elements_by_category", {"category": "Walls"})
+
+# Test 15: Create Floor
+print("\n" + "="*60)
+print("Creating Floor Slab")
+print("="*60)
+test("revit.create_floor", {
+ "boundary": [
+ [0, 0, 0],
+ [10000, 0, 0],
+ [10000, 12000, 0],
+ [0, 12000, 0]
+ ],
+ "level_name": "Level 1"
+})
+
+# Test 16: Create Rooms
+print("\n" + "="*60)
+print("Creating Rooms")
+print("="*60)
+
+test("revit.create_room", {
+ "location": [1500, 6000, 0],
+ "level_name": "Level 1",
+ "name": "Living Room",
+ "number": "101"
+})
+
+test("revit.create_room", {
+ "location": [6500, 3000, 0],
+ "level_name": "Level 1",
+ "name": "Bedroom 1",
+ "number": "102"
+})
+
+test("revit.create_room", {
+ "location": [6500, 9000, 0],
+ "level_name": "Level 1",
+ "name": "Bedroom 2",
+ "number": "103"
+})
+
+test("revit.create_room", {
+ "location": [8500, 3000, 0],
+ "level_name": "Level 1",
+ "name": "Bathroom",
+ "number": "104"
+})
+
+# Test 17: Save
+print("\n" + "="*60)
+print("Saving Document")
+print("="*60)
+test("revit.save_document")
+
+print("\n" + "="*60)
+print(f"COMPLETE - {test.counter} tests run")
+print("="*60)