|
|
1 mesiac pred | |
|---|---|---|
| src | 1 mesiac pred | |
| .gitignore | 1 mesiac pred | |
| README.md | 1 mesiac pred | |
| __init__.py | 1 mesiac pred | |
| config.py | 1 mesiac pred | |
| helpers.py | 1 mesiac pred | |
| pyproject.toml | 1 mesiac pred | |
| requirements.txt | 1 mesiac pred | |
| test.sh | 1 mesiac pred | |
| test_garden_layer.py | 1 mesiac pred |
The garden layer sits on top of virtuoso_mcp. It knows your garden-specific URIs (cycles, clone roots, seed products) but delegates every SPARQL/insert/discovery call to the MCP helpers.
config.py loads .env values and exposes the Garden URIs (seed product, cycle 2026-3, clone property, etc.).helpers.py defines GardenLayer, which wraps MCP tools such as insert_triple, traverse_property, and ontology discovery into domain actions (add_seedling, traverse).GardenLayer now exposes these convenience methods:
describe_subject(subject_uri, limit=10) – returns predicates/objects (with labels) for a given node.path_traverse(subject_uri, property_path, direction="outgoing", limit=10) – walks a property sequence from the subject and returns each step’s bindings.property_usage_statistics(property_uri, examples_limit=5) – reports how often a property is used and includes sample subjects/objects.batch_insert(ttl, graph=None) – pushes a TTL snippet (or multiple triples via TTL) into the chosen graph in a single request.These helpers keep domain code focused on planned workflows while still leveraging the generic MCP toolset.
virtuoso_mcp owns generic capabilities: query guardrails, traversal, ontology/class/property discovery.garden_layer owns domain workflows: breeding lifecycle helpers, documentation flows, trait-specific routines.This split allows additional specialized layers to reuse the same generic ontology tooling without copy/paste.
from garden_layer import GardenLayer
from garden_layer.config import SEED_PRODUCT, CYCLE_2026_3
garden = GardenLayer()
garden.add_seedling(
plant_uri="http://world.eu.org/example1#Plant_cookie_kerosene_2027",
seed_product_uri=SEED_PRODUCT,
cycle_uri=CYCLE_2026_3,
label="Cookie x Kerosene 2027",
)
garden_layer/test_garden_layer.py exercises the garden helpers (traverse, describe_subject, path_traverse, property_usage_statistics, and batch_insert) against a running MCP server. The suite now also posts directly to the garden_* MCP tools (e.g., garden_describe_subject and garden_property_usage_statistics) to confirm the server endpoint is registered and returns expected bindings. Start the MCP service (./virtuoso_mcp/run.sh or ./restart.sh) before running the tests and invoke them with python3 -m pytest garden_layer/test_garden_layer.py. If pytest is not installed, install it inside a virtual environment (e.g., python3 -m venv .env && .env/bin/pip install pytest).
garden_layer repo to your private git server (e.g., https://repo.home.world.eu.org/lucky/garden_layer.git).Install it inside the MCP host environment:
pip install --upgrade git+https://repo.home.world.eu.org/lucky/garden_layer.git
The package can be uninstalled later with pip uninstall garden-layer.
Restart the MCP server so it picks up the new helpers (our restart.sh already calls killserver.sh before run.sh):
cd /home/lucky/.openclaw/workspace/virtuoso_mcp
./restart.sh
Re-run the garden-layer suite with GARDEN_LAYER_VENV pointing at whatever virtualenv you want to use (our example venv lives at garden_layer/.venv):
cd /home/lucky/.openclaw/workspace/garden_layer
GARDEN_LAYER_VENV="$PWD/.venv" ./test.sh
Once the package is installed you can import garden_layer.GardenLayer from your own MCP host code (or use it in agents) to orchestrate the domain helpers; building additional /mcp endpoints that simply call GardenLayer keeps your plugins reusable and the core MCP server generic.