Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
246 changes: 240 additions & 6 deletions admin_manual/ai/app_context_agent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ Artificial intelligence tools

* Example prompt: *"What is the company's sick leave process?"*

* Search for documents in context chat without generating an answer (requires :ref:`Context Chat<ai-app-context_chat>`)

* Example prompt: *"Find the documents that mention our travel expense policy."*

* List the content providers that context chat can search (requires :ref:`Context Chat<ai-app-context_chat>`)

* Example prompt: *"Which sources can context chat search?"*

* Transcribe a media file (requires Transcribe audio task type enabled)

* Example prompt: *"Can you transcribe the following file? https://mycloud.com/f/9825679"* (Can be selected via smart picker.)
Expand All @@ -35,6 +43,32 @@ Artificial intelligence tools

* Example prompt: *"Can you generate me an image of a cartoon drawing of a roman soldier typing something on a laptop?"*

* Edit an existing image or combine several images (requires Image-to-image task type enabled)

* Example prompt: *"Remove the background from the image Photos/cat.jpg."*

Assistant scheduled tasks tools
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Scheduled tasks are carried out by the agent autonomously on a recurring schedule. The user still has to approve
sensitive actions.

* Create a scheduled task

* Example prompt: *"Every morning at 8, summarize my unread mails and send the summary to me in Talk."*

* List scheduled tasks

* Example prompt: *"Which scheduled tasks do I have?"*

* Update a scheduled task

* Example prompt: *"Change my mail summary task to run at 9 instead."*

* Delete a scheduled task

* Example prompt: *"Delete my mail summary task."*

Calendar tools
~~~~~~~~~~~~~~

Expand All @@ -50,6 +84,10 @@ Calendar tools

* Example prompt: *"Find a free 1-hour slot for a meeting with me and Marco next week."*

* Search the user's calendar events in a time range, optionally by search terms

* Example prompt: *"Which dentist appointments do I have in the next three months?"*

Tasks tools
~~~~~~~~~~~

Expand Down Expand Up @@ -82,6 +120,10 @@ Circles/teams tools

* Example prompt: *"List all my teams."*

* Get the details of a circle

* Example prompt: *"Show me the details of the Hiking group team."*

* List circle members

* Example prompt: *"List all members of my Content Marketing team."*
Expand Down Expand Up @@ -226,6 +268,30 @@ Deck tools (require `Deck <https://apps.nextcloud.com/apps/deck>`_)

* Example prompt: *"List the deck boards I have access to."*

* Create a new deck board

* Example prompt: *"Create a new deck board called 'Home renovation'."*

* Share a deck board with a user

* Example prompt: *"Share my Home renovation deck board with Andrew, but don't let him share it further."*

* Stop sharing a deck board with a user

* Example prompt: *"Stop sharing my Home renovation deck board with Andrew."*

* Create a new stack on a deck board

* Example prompt: *"Add a stack called 'In progress' to my Home renovation deck board."*

* Rename a stack

* Example prompt: *"Rename the 'In progress' stack on my Home renovation deck board to 'Doing'."*

* Delete a stack together with all its cards

* Example prompt: *"Delete the 'Ideas' stack from my Home renovation deck board."*

* List the cards on a deck board

* Example prompt: *"List the cards on my Personal deck board."*
Expand All @@ -234,14 +300,34 @@ Deck tools (require `Deck <https://apps.nextcloud.com/apps/deck>`_)

* Example prompt: *"Can you add a card with title 'Repair kitchen sink' to my Personal deck board?"*

* Update a card's title, description, due date or done status

* Example prompt: *"Mark the 'Repair kitchen sink' card on my Personal deck board as done."*

* Move a card to another stack

* Example prompt: *"Move the 'Repair kitchen sink' card on my Personal deck board to the 'Done' stack."*

* Archive or unarchive a card

* Example prompt: *"Archive the 'Repair kitchen sink' card on my Personal deck board."*

* Add a label to a card

* Example prompt: *"Can you add the label 'Urgent' to the 'repair kitchen sink' card in my personal deck board?"*

* Remove a label from a card

* Example prompt: *"Remove the label 'Urgent' from the 'Repair kitchen sink' card in my Personal deck board."*

* Assign a card to a user

* Example prompt: *"Can you assign the 'Repair kitchen sink' card in my Personal deck board to Andrew?"*

* Remove a user's assignment from a card

* Example prompt: *"Unassign Andrew from the 'Repair kitchen sink' card in my Personal deck board."*

* Delete a card

* Example prompt: *"Delete the 'Repair kitchen sink' card in my Personal deck board."*
Expand Down Expand Up @@ -270,10 +356,22 @@ Files tools
* Example prompt: *"Can you fetch the following file in my documents? Design/Planning.md"*
* Example prompt: *"Can you fetch the following file in my documents? https://mycloud.com/f/98543234"*

* Retrieve folder tree
* Retrieve file tree, optionally with metadata like file IDs and modification times

* Example prompt: *"List my files."*

* Retrieve folder tree

* Example prompt: *"Which folders do I have?"*

* Look up the ID of a file by its path, or the path of a file by its ID

* Example prompt: *"What is the file ID of Design/Planning.md?"*

* Convert a file to another format

* Example prompt: *"Convert Reports/Q3.docx to PDF."*

* Create a public link for a file or folder

* Example prompt: *"Create a public link for the following file: Design/Planning.md"*
Expand Down Expand Up @@ -309,6 +407,10 @@ Forms tools

* Example prompt: *"Can you give me all details about the Retreat signup form?"*

* Create a new form

* Example prompt: *"Create a new form called 'Retreat signup'."*

* Add a question to a form

* Example prompt: *"Add the following question to the retreat signup form: 'Number of days attending'."*
Expand All @@ -332,6 +434,10 @@ Bookmarks tools

* Example prompt: *"List all my bookmarks."*

* Search for bookmarks

* Example prompt: *"Do I have any bookmarks about hiking?"*

* Add a bookmark

* Example prompt: *"Add a bookmark for https://nextcloud.com with title 'Nextcloud homepage'."*
Expand Down Expand Up @@ -536,6 +642,53 @@ Mail tools (require `Mail <https://apps.nextcloud.com/apps/mail>`_)

* Example prompt: *"List the last 5 mails in the inbox of my carry@company.com account"*

* Get a single mail including its full text

* Example prompt: *"Show me the full text of the latest mail from Andrew in my carry@company.com inbox"*


Memories tools
~~~~~~~~~~~~~~

The agent can remember information across conversations. Memories are stored as Markdown files in the user's
Assistant folder.

* Store a memory, or update an existing one

* Example prompt: *"Remember that I prefer meetings in the morning."*

* List the stored memories

* Example prompt: *"What do you remember about me?"*

* Load a memory

* Example prompt: *"What did I tell you about my meeting preferences?"*

* Search the stored memories (requires :ref:`Context Chat<ai-app-context_chat>`)

* Example prompt: *"Do you remember anything about my travel plans?"*

* Delete a memory or a folder of memories

* Example prompt: *"Forget what I told you about my meeting preferences."*


Skills tools (require Nextcloud Assistant 3.5.0 or higher)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Skills are reusable instructions that teach the agent how to perform a particular task, for example a procedure,
a checklist or a style guide. The names and descriptions of all skills are shown to the agent in every
conversation, so it can load the full instructions of a skill when they are relevant.

* Load a skill

* Example prompt: *"Write the release announcement following our announcement skill."*

* Create or update a skill

* Example prompt: *"Save the steps we just went through as a skill for onboarding new employees."*


Miscellaneous tools
~~~~~~~~~~~~~~~~~~~
Expand All @@ -548,6 +701,10 @@ Miscellaneous tools

* Example prompt: *"Can you show me a map of New York, please"*

* Get a route between two locations by foot, bike or car using Open Street Maps

* Example prompt: *"How long does it take to cycle from Würzburg Hauptbahnhof to the Residenz?"*

* Get the current weather at a location

* Example prompt: *"How is the weather in Berlin?"*
Expand All @@ -560,6 +717,18 @@ Miscellaneous tools

* Example prompt: *"Show me search results for quick pasta recipes, please."*

* Fetch the content of a web page (only addresses on the public internet can be reached)

* Example prompt: *"Summarize the article at https://nextcloud.com/blog/"*

* Get the current date and time in the user's timezone

* Example prompt: *"What day is it today?"*

* Find out which app and item a Nextcloud link points to, to use it with the other tools

* Example prompt: *"Summarize the comments on this card: https://mycloud.com/apps/deck/board/3/card/42"*

* Determine public transport routes (requires a `HERE <https://www.here.com/>`_ API key configured in the admin settings)

* Example prompt: *"How can I get from Würzburg Hauptbahnhof to Berlin Hauptbahnhof?"*
Expand Down Expand Up @@ -601,11 +770,44 @@ These tools can also be combined by the agent to fulfil tasks like the following

* Gets the content of the file and sends it in a 1-1 Talk conversation with Andrew

Custom Tools using MCP
-----------------------
Tools for other apps from their OpenAPI descriptions
----------------------------------------------------

Since version 2.12.0, Context Agent can also use the APIs of Nextcloud apps that it has no dedicated tools for.
Many Nextcloud apps publish an OpenAPI description of their API. Context Agent reads these descriptions and offers
each endpoint of an app as a tool of its own.

To use this feature:

1. Install the `OCS API Viewer <https://apps.nextcloud.com/apps/ocs_api_viewer>`_ app. Context Agent uses it to
find the apps that are enabled for a user and to load their OpenAPI descriptions.
2. Let users use Context Agent as usual. Apps are detected while users chat with the agent, so an app only appears
in the settings once a user it is enabled for has used Context Agent.
3. In the Context Agent admin settings, under **Offer the APIs of these apps as tools**, check the apps whose APIs the
agent should use. Newly detected apps start out unchecked.

Keep the following in mind:

* Every endpoint of a checked app becomes a tool, and the descriptions of all tools count towards the
**Maximum size of a request to the language model**. Check only the apps you need.
* Only the regular user-facing API of an app is offered. The administration, federation and other API scopes, the
Nextcloud core API, and apps that Context Agent already has dedicated tools for are left out.
* Endpoints that only read data are treated as read-only tools. The agent always asks the user for confirmation
before it calls any other endpoint, because an OpenAPI description does not say who a call affects or whether it can
be undone.

Custom tools using MCP
----------------------

Model Context Protocol (MCP) is a protocol that enables Large Language Models (LLMs) to interact with external data sources and tools.
The Context Agent app allows administrators to extend its capabilities by adding custom services via MCP. This can be configured in the admin settings under "MCP Config," where you can provide a JSON configuration in the following format:
Context Agent can connect to MCP servers and offer their tools to the agent. Both administrators and, if allowed, users
can add MCP servers.

MCP servers added by the administrator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MCP servers added by the administrator are available to all users. They can be configured in the admin settings under
"MCP Config," where you can provide a JSON configuration in the following format:

.. code-block:: json

Expand All @@ -616,6 +818,38 @@ The Context Agent app allows administrators to extend its capabilities by adding
}
}

Context Agent cannot tell what an MCP tool does, so by default it asks the user to confirm every call to one.
Add ``"trust_annotations": true`` to a service to let the read-only and destructive hints that the service declares
for its tools decide when to ask for confirmation. Alternatively, list the names of trusted tools under
**MCP tools that never need confirmation**, or enter ``*`` to allow all MCP tools. Only do this for services you trust.

MCP servers added by users
~~~~~~~~~~~~~~~~~~~~~~~~~~

Since Context Agent 2.12.0 and :ref:`Nextcloud Assistant<ai-app-assistant>` 4.2.0, users can connect their own MCP
servers to "Chat with AI". This allows them to use services that need a personal access token for each user.

To allow this, enable **Allow users to connect their own MCP servers to "Chat with AI" in their personal settings**
in the Assistant admin settings. Users can then add MCP servers in their personal Assistant settings under
**MCP servers** by entering a name, the URL of the server's streamable HTTP endpoint, and optionally HTTP headers,
for example an ``Authorization`` header with a personal token. Header values are stored encrypted.

The following restrictions apply to MCP servers added by users:

* The agent always asks the user to confirm every call to one of their tools, regardless of the hints the tools
declare. The trust settings for the administrator's MCP servers do not apply to them.
* Only servers on the public internet that use HTTPS are allowed. Context Agent connects to them directly, without
the proxy configured for it.
* Each user can add up to 5 servers, and up to 50 tools are used from each server. Tools with very large input
schemas are left out, and long tool descriptions are shortened.
* The tools of a user's server are named ``mcp_user_<server name>__<tool name>``. A tool with the same name as a tool
of one of the administrator's MCP servers is left out.
* The tools of these servers act with the user's access to Nextcloud and see what the user shares with the agent.
Users should only connect services they trust.

If the administrator disables the setting again, the agent stops using the servers of all users. Users can still
remove the servers from their settings.

Requirements
------------

Expand Down Expand Up @@ -679,6 +913,6 @@ Known Limitations
* Most models have difficulties with languages other than English. Some models sometimes answer in a different language than the one used by the user.
* Customer support is available upon request, however we can't solve false or problematic output, most performance issues, or other problems caused by the underlying model.
Support is thus limited only to bugs directly caused by the implementation of the app (connectors, API, front-end, AppAPI). We still try to optimize this as far as possible, so if you encounter any false or problematic output, you can report it `in a dedicated Github issue <https://github.com/nextcloud/context_agent/issues/51>`_ to help us improve this app.
* When multiple MCP services are configured that have tools with the same name undefined behavior will occur.
* When multiple MCP services configured by the administrator have tools with the same name undefined behavior
will occur.
* Only remote MCP services are supported (streamable_http transport).
* MCP services that require different access tokens for each user are not currently supported.
Loading