Skip to content

Refactor: Tool registry on server #20673

@ngxson

Description

@ngxson

Background Description

Currently, llama-server has no knowledge about tools or MCP, all the logic is implemented on webui client side. This introduce a lot of duplicated code if we want to also support MCP and tools on llama-cli

The plan is to allow user to use built-in tools and MCP tools from llama-cli by having a mcp.json file

Possible Refactor Approaches

Tool registry will allow having 2 types of tools:

  • Built-in tools, served in OAI-compat schema
  • MCP tools: this will reflect just the server URL, NOT a list of tools from that server. The client will be responsible for extracting tools from this server (on webui, we already had this logic; on CLI, we will need to implement this logic)

For MCP tools, we support both streaming HTTP and stdio protocols, using http://, https:// and stdio:// protocols respectively

Client call POST /tools to effectively "proxy" the request to the destination MCP server/stdio

Example of a list returned from GET /tools:

  • read_file: built-in tool
  • edit_file: built-in tool
  • list_files: built-in tool
  • huggingface-mcp: MCP server
  • python-interpreter: MCP stdio

Metadata

Metadata

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions