module documentation

llmtools.py – ZMS tool registry for LLM function/tool calling.

Provides:

  • ``LLM_TOOLS``: built-in tool schemas (OpenAI-format, also accepted by Ollama v0.3+).
  • ``execute_llmtool(name, args, context)``: built-in dispatcher for core ZMS tools.
  • ``ZMSLLMToolsAdapter``: abstraction layer that can load custom toolsets from ``*_llmtools`` ZMSLibrary meta-objects and dispatch custom ``llmtool_*`` actions.

All tools operate on the metamodel manager reachable via the ZMS acquisition context.

License: GNU General Public License v2 or later, Organization: ZMS Publishing

Class ZMSLLMToolsAdapter Resolve active LLM tools connector and dispatch tool calls.
Function execute_llmtool Dispatch a tool call to the corresponding ZMS API.
Function get_available_llmtools_connectors Return available custom LLM tools connectors (ZMSLibrary meta-objects).
Constant LLM_TOOLS Undocumented
Function _tool_index_qdrant Crawl every ZMS page, render its body content, chunk + embed the text, and upsert all vectors into the configured Qdrant collection.
def execute_llmtool(name, args, context): (source)

Dispatch a tool call to the corresponding ZMS API.

Parameters
nameTool name as returned in the LLM tool_call.
argsDict of parsed arguments from the LLM.
contextZMS acquisition context (must have ``metaobj_manager`` attribute).
Returns
JSON-serialisable result dict.
def get_available_llmtools_connectors(context): (source)

Return available custom LLM tools connectors (ZMSLibrary meta-objects).

A connector is any ``ZMSLibrary`` matching either:

  • id ends with ``_llmtools`` (generic naming), or
  • id ends with ``_connector`` and package starts with ``com.zms.llmtools.`` (connector-style naming, e.g. ``ollama_connector``).
LLM_TOOLS: list[dict] = (source)

Undocumented

Value
[{'type': 'function',
  'function': {'name': 'list_content_types',
               'description': 'Return the list of all content type IDs defined i
n the ZMS metamodel. Use this first to discover what types already exist before 
creating new ones.',
               'parameters': {'type': 'object',
                              'properties': {},
...
def _tool_index_qdrant(args, context): (source)

Crawl every ZMS page, render its body content, chunk + embed the text, and upsert all vectors into the configured Qdrant collection.

Runs fully inside the Zope process — no external HTTP calls required.