Skip to content

feat(search): Add a tool for each unified search provider available in Nextcloud#120

Merged
janepie merged 5 commits intomainfrom
feat/search
Mar 5, 2026
Merged

feat(search): Add a tool for each unified search provider available in Nextcloud#120
janepie merged 5 commits intomainfrom
feat/search

Conversation

@marcelklehr
Copy link
Member

Thanks to @TheBest-Name

…n Nextcloud

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new tool module that exposes Nextcloud Unified Search providers as LangChain tools, enabling the agent to run provider-specific searches via the Nextcloud OCS search APIs.

Changes:

  • Introduce ex_app/lib/all_tools/search.py to dynamically fetch unified search providers and generate one tool per provider.
  • Add a new “Unified Search” tool category for the UI/tool grouping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

marcelklehr and others added 2 commits March 2, 2026 18:30
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@TheBest-Name
Copy link

The tests seem to use the "search_the_web" tool. Is that a tool? Shouldn't it use "youtube_search"? Although I guess that is already with another tool, which is a big problem. This does add all Search providers, even if their added or taken care of elsewhere, which can confuse the LLM on which tool to use.

@marcelklehr
Copy link
Member Author

mmh, but we do have a youtube_search tool, as well. In my tests the tools were not confusing the llm, but maybe in this case here the context window is too small to fit the tool descriptions of all tools?

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@TheBest-Name
Copy link

Speaking of tool descriptions, how are those passed?
Is it the .doc or is that more just for documentation?
If it is just one static prompt, then that seems hard to maintain as the number of tools grow.

@TheBest-Name
Copy link

I just had a great idea (I think).
Notice how the tools are mostly copies of each other, why not merge them into one or two tools?
That would help for low context spaces and might be beneficial.
You said the AI could chain tool calls together right? Just have the tools like how they are as an endpoint.
First tool lists search providers then second tool search any tool provider as a parameter, that way the LLM only needs the context when it is actually searching something.

@marcelklehr
Copy link
Member Author

The tools are passed to the Chat with Tools task provider in nextcloud which gives them either to the openAI server or to the llm2 instance, where they are stringified. The descriptions for each tool are the doc strings.

@marcelklehr
Copy link
Member Author

The problem might be the youtube_search description:

"name": "youtube_search", "description": "search for youtube videos associated with a person. the input to this tool should be a comma separated list, the first part contains a person name and the second a number that is the maximum number of video results to return aka num_results. the second part is optional

"Nextcloud" is not a person, so it tries a hallucinated tool, I guess?

Use get_folder_tree instead of youtube_search

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Copy link
Member

@janepie janepie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@janepie janepie merged commit 6c7b875 into main Mar 5, 2026
6 checks passed
@janepie janepie deleted the feat/search branch March 5, 2026 15:18
@TheBest-Name
Copy link

What did you think of my idea for reducing the needed context?

@marcelklehr
Copy link
Member Author

@TheBest-Name it's a good idea in general to reduce the tokens needed for explaining tools to the llm. In this case I'm not sure how well it would have worked and if the benefits outweigh the risks of the llm not getting how to use this tandem of tools.

@marcelklehr
Copy link
Member Author

We have a new approach to tools in mind however that will greatly reduce the tokens needed for explaining tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants