rhinomcp 0.1.3.1__py3-none-any.whl → 0.1.3.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rhinomcp/__init__.py +2 -1
- rhinomcp/server.py +0 -11
- rhinomcp/static/{rhinoscriptsyntax.json → rhinoscriptsyntax.py} +1 -1
- rhinomcp/tools/get_object_info.py +21 -6
- rhinomcp/tools/get_rhinoscript_python_code_guide.py +1 -1
- rhinomcp/tools/get_rhinoscript_python_function_names.py +1 -1
- rhinomcp/tools/get_selected_objects_info.py +7 -3
- {rhinomcp-0.1.3.1.dist-info → rhinomcp-0.1.3.3.dist-info}/METADATA +1 -1
- {rhinomcp-0.1.3.1.dist-info → rhinomcp-0.1.3.3.dist-info}/RECORD +12 -12
- {rhinomcp-0.1.3.1.dist-info → rhinomcp-0.1.3.3.dist-info}/WHEEL +0 -0
- {rhinomcp-0.1.3.1.dist-info → rhinomcp-0.1.3.3.dist-info}/entry_points.txt +0 -0
- {rhinomcp-0.1.3.1.dist-info → rhinomcp-0.1.3.3.dist-info}/top_level.txt +0 -0
rhinomcp/__init__.py
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
__version__ = "0.1.0"
|
4
4
|
|
5
5
|
# Expose key classes and functions for easier imports
|
6
|
-
from .
|
6
|
+
from .static.rhinoscriptsyntax import rhinoscriptsyntax_json
|
7
|
+
from .server import RhinoConnection, get_rhino_connection, mcp, logger
|
7
8
|
|
8
9
|
from .prompts.assert_general_strategy import asset_general_strategy
|
9
10
|
|
rhinomcp/server.py
CHANGED
@@ -7,17 +7,6 @@ import logging
|
|
7
7
|
from dataclasses import dataclass
|
8
8
|
from contextlib import asynccontextmanager
|
9
9
|
from typing import AsyncIterator, Dict, Any, List
|
10
|
-
import os
|
11
|
-
from pathlib import Path
|
12
|
-
import base64
|
13
|
-
from urllib.parse import urlparse
|
14
|
-
|
15
|
-
# Define path to static folder
|
16
|
-
JSONFILE = Path("./src/rhinomcp/static/rhinoscriptsyntax.json")
|
17
|
-
|
18
|
-
with open(JSONFILE, 'r') as f:
|
19
|
-
rhinoscriptsyntax_json = json.loads(f.read())
|
20
|
-
|
21
10
|
|
22
11
|
# Configure logging
|
23
12
|
logging.basicConfig(level=logging.INFO,
|
@@ -1,13 +1,28 @@
|
|
1
1
|
from mcp.server.fastmcp import Context
|
2
2
|
import json
|
3
3
|
from rhinomcp import get_rhino_connection, mcp, logger
|
4
|
+
from typing import Dict, Any
|
4
5
|
|
5
6
|
@mcp.tool()
|
6
|
-
def get_object_info(ctx: Context, id: str = None, name: str = None) -> str:
|
7
|
+
def get_object_info(ctx: Context, id: str = None, name: str = None) -> Dict[str, Any]:
|
7
8
|
"""
|
8
9
|
Get detailed information about a specific object in the Rhino document.
|
10
|
+
The information contains the object's id, name, type, all custom user attributes and geometry info.
|
9
11
|
You can either provide the id or the object_name of the object to get information about.
|
10
12
|
If both are provided, the id will be used.
|
13
|
+
|
14
|
+
Returns:
|
15
|
+
- A dictionary containing the object's information
|
16
|
+
- The dictionary will have the following keys:
|
17
|
+
- "id": The id of the object
|
18
|
+
- "name": The name of the object
|
19
|
+
- "type": The type of the object
|
20
|
+
- "layer": The layer of the object
|
21
|
+
- "material": The material of the object
|
22
|
+
- "color": The color of the object
|
23
|
+
- "bounding_box": The bounding box of the object
|
24
|
+
- "geometry": The geometry info of the object
|
25
|
+
- "attributes": A dictionary containing all custom user attributes of the object
|
11
26
|
|
12
27
|
Parameters:
|
13
28
|
- id: The id of the object to get information about
|
@@ -15,10 +30,10 @@ def get_object_info(ctx: Context, id: str = None, name: str = None) -> str:
|
|
15
30
|
"""
|
16
31
|
try:
|
17
32
|
rhino = get_rhino_connection()
|
18
|
-
|
19
|
-
|
20
|
-
# Just return the JSON representation of what Rhino sent us
|
21
|
-
return json.dumps(result, indent=2)
|
33
|
+
return rhino.send_command("get_object_info", {"id": id, "name": name})
|
34
|
+
|
22
35
|
except Exception as e:
|
23
36
|
logger.error(f"Error getting object info from Rhino: {str(e)}")
|
24
|
-
return
|
37
|
+
return {
|
38
|
+
"error": str(e)
|
39
|
+
}
|
@@ -3,11 +3,15 @@ import json
|
|
3
3
|
from rhinomcp import get_rhino_connection, mcp, logger
|
4
4
|
|
5
5
|
@mcp.tool()
|
6
|
-
def get_selected_objects_info(ctx: Context) -> str:
|
7
|
-
"""Get detailed information about the currently selected objects in Rhino
|
6
|
+
def get_selected_objects_info(ctx: Context, include_attributes: bool = False) -> str:
|
7
|
+
"""Get detailed information about the currently selected objects in Rhino
|
8
|
+
|
9
|
+
Parameters:
|
10
|
+
- include_attributes: Whether to include the custom user attributes of the objects in the response
|
11
|
+
"""
|
8
12
|
try:
|
9
13
|
rhino = get_rhino_connection()
|
10
|
-
result = rhino.send_command("get_selected_objects_info")
|
14
|
+
result = rhino.send_command("get_selected_objects_info", {"include_attributes": include_attributes})
|
11
15
|
return json.dumps(result, indent=2)
|
12
16
|
except Exception as e:
|
13
17
|
logger.error(f"Error getting selected objects from Rhino: {str(e)}")
|
@@ -1,7 +1,7 @@
|
|
1
|
-
rhinomcp/__init__.py,sha256=
|
2
|
-
rhinomcp/server.py,sha256=
|
1
|
+
rhinomcp/__init__.py,sha256=ZHchPee5EDS_KuvxJCKcTblKQom6X0s7AV2XFHIKP_k,1228
|
2
|
+
rhinomcp/server.py,sha256=fbEs4HBLWTudg-e6BpFz294JV8pruqw8yBRgrmlEV2w,9415
|
3
3
|
rhinomcp/prompts/assert_general_strategy.py,sha256=Aovach0WYClUw191iX_Mwyh2KlxdVp0gB2Wt4eiQDvM,1250
|
4
|
-
rhinomcp/static/rhinoscriptsyntax.
|
4
|
+
rhinomcp/static/rhinoscriptsyntax.py,sha256=xrIBMxVs9qTXIzDQT3jLILF4TS-7MbNMqJrBY5KlOUk,1480485
|
5
5
|
rhinomcp/tools/create_layer.py,sha256=Pz6xgKsiNZGRcUwc4nQrvSWwRNc9Uv5Vs4g-lKQz82c,1377
|
6
6
|
rhinomcp/tools/create_object.py,sha256=uO5EhuM7SO9eq9senvskdiblZsWmveHHQxce9pMW7-g,3333
|
7
7
|
rhinomcp/tools/create_objects.py,sha256=974VI3C_iLjz9nJ6ya0fwxbsI0u0rlyb_cM98W6T86U,2616
|
@@ -9,16 +9,16 @@ rhinomcp/tools/delete_layer.py,sha256=MjvN2-AKHD1dbMIMqfrb3Bevjj63ooWGzqlFpOopju
|
|
9
9
|
rhinomcp/tools/delete_object.py,sha256=-Vz1AZlw0-hPQZ9wNVTpa5sRDJ2qLiDnfjSYKp2wafc,987
|
10
10
|
rhinomcp/tools/execute_rhinoscript_python_code.py,sha256=iHaXptYxGc0YY_oxBn_qwYr3l14ycjirRW96Q78eEPY,1585
|
11
11
|
rhinomcp/tools/get_document_info.py,sha256=poPyqfO0KeV5Au3jks9Q3o6tTZVDfEuCm9BZWCLfpqY,613
|
12
|
-
rhinomcp/tools/get_object_info.py,sha256=
|
12
|
+
rhinomcp/tools/get_object_info.py,sha256=LRVY__C8CA_-Wux9GGRaXHB3W7FHcrQa1DCXAOiZWgg,1564
|
13
13
|
rhinomcp/tools/get_or_set_current_layer.py,sha256=xIvwvrmWXjnxC0WDLEMFxLAUOUjL8LD-8sQ2OYPO-nw,1493
|
14
|
-
rhinomcp/tools/get_rhinoscript_python_code_guide.py,sha256=
|
15
|
-
rhinomcp/tools/get_rhinoscript_python_function_names.py,sha256=
|
16
|
-
rhinomcp/tools/get_selected_objects_info.py,sha256=
|
14
|
+
rhinomcp/tools/get_rhinoscript_python_code_guide.py,sha256=phS1tCive-lwlWOrE4UW4Ydl1CDuGfqCYU9x6MuQgKY,928
|
15
|
+
rhinomcp/tools/get_rhinoscript_python_function_names.py,sha256=YLDtE8TIFXlMqcUSSpMLshoyB5bxPYiiwcsVY1phsSQ,1360
|
16
|
+
rhinomcp/tools/get_selected_objects_info.py,sha256=TG9pUz1NscYOoSUQN-vnl-zuILbjd9GAouJtT9oxUbk,780
|
17
17
|
rhinomcp/tools/modify_object.py,sha256=OVQa75PAmuVx-YslxSC2ITdFbp6cCELVaacI77sJ7Zg,1912
|
18
18
|
rhinomcp/tools/modify_objects.py,sha256=52okeGwV5IQiuBSBH9HcyDCxWbCNF4eA7LoLuhLlgp4,1498
|
19
19
|
rhinomcp/tools/select_objects.py,sha256=J9QjfnD9gdepTCqalBDqOi9nJEX9D3sLPJKImTcJciI,1935
|
20
|
-
rhinomcp-0.1.3.
|
21
|
-
rhinomcp-0.1.3.
|
22
|
-
rhinomcp-0.1.3.
|
23
|
-
rhinomcp-0.1.3.
|
24
|
-
rhinomcp-0.1.3.
|
20
|
+
rhinomcp-0.1.3.3.dist-info/METADATA,sha256=yu5RvHWmT_KjtAlEEfiwSO9_Zb4lZswVFdWlR17GAnY,920
|
21
|
+
rhinomcp-0.1.3.3.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
22
|
+
rhinomcp-0.1.3.3.dist-info/entry_points.txt,sha256=OserOidtKWCl-_h3O1c2e9La6wYmJ9rE5F_T5wRLX9w,50
|
23
|
+
rhinomcp-0.1.3.3.dist-info/top_level.txt,sha256=sw73qoWC7GQp5upujkME6pRWc8OxBydEeDwQqu-qv4U,9
|
24
|
+
rhinomcp-0.1.3.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|