Skip to content

Commit aae9cda

Browse files
committed
chore: #219 - adds properties to MCP
1 parent d8b6bf2 commit aae9cda

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
TAG_SERVICES: 0.0.9
2323
TAG_EXTERNAL: 0.0.1
2424
TAG_UI: 0.0.31
25-
TAG_MCP: 0.0.7
25+
TAG_MCP: 0.0.8
2626

2727
steps:
2828
- name: Checkout code

objectified-mcp/server.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ async def get_field_by_id(id: str) -> list[str]:
8585
print(f"[get_field_by_id] id={id}")
8686
return result if len(result) > 0 else "{}"
8787

88+
@mcp.resource("properties://{name}/by_name")
89+
async def get_properties_by_name(name: str) -> list[str]:
90+
"""Retrieves a list of properties by ID and name based on the name specified"""
91+
conn = connect_to_postgres(DATABASE_URL)
92+
results = run_query(conn, "SELECT id, name FROM obj.property WHERE name LIKE %s", (f"%{name}%",))
93+
print(f"[get_properties_by_name]: search={name} results={len(results)}")
94+
return results if len(results) > 0 else []
95+
96+
@mcp.resource("properties://{id}/by_id")
97+
async def get_property_by_id(id: str) -> list[str]:
98+
"""Retrieves property information by ID"""
99+
conn = connect_to_postgres(DATABASE_URL)
100+
result = run_query(conn, "SELECT * FROM obj.property WHERE id=%s", (id,))
101+
print(f"[get_property_by_id] id={id}")
102+
return result if len(result) > 0 else "{}"
103+
88104
if __name__ == "__main__":
89105
print("""
90106
██████ ██████ ██ ███████ ██████ ████████ ██ ███████ ██ ███████ ██████

0 commit comments

Comments
 (0)