> For the complete documentation index, see [llms.txt](https://docs.algenta.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.algenta.ai/mcp-tools/runtime-libraries.md).

# Runtime library tools

These two tools expose the **local runtime-backed Mojo library** surface: the compiled compute catalog your Algenta engine can execute directly. Unlike the rest of the MCP catalog, they do not route through the hosted `/v1` data and query APIs — they talk to the local Algenta runtime daemon. Reach for them when you need raw runtime-backed compute rather than the governed data, query, or decision tools.

{% hint style="info" %}
Both tools require a running local Algenta runtime. If the daemon is unreachable they return an error telling you to start it first. See [Run the Mojo engine](/run-the-engine/mojo-sidecar.md).
{% endhint %}

## Tools

| Tool                      | What it does                                                                           | Key inputs                                                                                        |
| ------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `list_runtime_libraries`  | List executable local-runtime Mojo libraries and their functions, with runtime health. | `search` (lexical filter over module and function names), `limit` (max libraries after filtering) |
| `execute_runtime_library` | Execute one runtime library function by module and function name.                      | `module` (required), `function` (required), `args` (object, array, scalar, or null), `request_id` |

## Worked examples

### List the runtime catalog

`list_runtime_libraries` returns the runtime health, a module count, and each library's `name`, `engine`, and `functions`. Pass `search` to filter by module or function name.

{% tabs %}
{% tab title="MCP tool call" %}

```json
{ "search": "image", "limit": 10 }
```

```json
{
  "runtime_health": { "status": "ok" },
  "module_count": 1,
  "libraries": [
    { "name": "image", "engine": "mojo", "functions": ["resize", "decode", "encode"] }
  ]
}
```

{% endtab %}

{% tab title="Prompt" %}
A natural first prompt for an MCP host:

{% hint style="success" %}
List the runtime libraries, then run the `resize` function from the `image` module on my sample payload.
{% endhint %}
{% endtab %}
{% endtabs %}

### Execute a library function

`execute_runtime_library` takes the `module` and `function` names from the catalog above, plus an `args` payload that can be a JSON object, array, scalar, or null. The result reports the return value along with `latency_ms` and which `engine_used` served the call.

{% tabs %}
{% tab title="MCP tool call" %}

```json
{
  "module": "image",
  "function": "resize",
  "args": { "width": 128, "height": 128 },
  "request_id": "req-demo-1"
}
```

```json
{
  "module": "image",
  "function": "resize",
  "args": { "width": 128, "height": 128 },
  "result": { "width": 128, "height": 128 },
  "latency_ms": 3.1,
  "engine_used": "mojo",
  "success": true
}
```

{% endtab %}

{% tab title="Failure" %}
If the daemon is not running, the tool fails fast rather than silently falling back:

```json
{ "error": "Local Algenta runtime daemon is unavailable. Start it before using runtime library MCP tools." }
```

A failed execution surfaces the runtime's own error message so you can act on it.
{% endtab %}
{% endtabs %}

## Related references

{% content-ref url="/pages/zckshsBx1v9QwYvImRX6" %}
[Run the Mojo engine](/run-the-engine/mojo-sidecar.md)
{% endcontent-ref %}

{% content-ref url="/pages/9l598Hwbo4aGEvKi96R8" %}
[MCP server](/sdks/mcp.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.algenta.ai/mcp-tools/runtime-libraries.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
