- Elemental
Elemental
Tool usage in Elemental
Elemental provides an interface to bring tools provided by Model Context Protocol (MCP) server. The tools are registered in the toolbox and can be used by the agent. The tools are brought to the ToolBox object with the same interface, however, definition of MCP servers must be present in the environment.
The MCP servers can be defined in the .env file in the mcpServers variable. Using Github MCP server as an example, the mcpServers entry could be
mcpServers='{"Github": {"command": "npx", "args": ["-y","@modelcontextprotocol/server-github"], "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"}}}'
The mcpServers variable should be a JSON string with name of the server as a key and three variables command, args, and env present for the key. More than one server may be defined.
The MCP tools in Elemental require following particular naming convention to bring them together with native tools. The name of the tool must be MCP|server_name|tool_name, where MCP indicates that the tool needs to come from an MCP server, server_name will indicate the correct entry in the mcpServers definition to use for this server, tool_name is the name of the individual tool in the given server.
Example below illustrates how to bring MCP defined tools together with native tools
box = ToolBox()
box.register_tool_by_name("PythonRunner")
box.register_tool_by_name("Calculator")
box.register_tool_by_name("MCP|Github|list_issues")
box.register_tool_by_name("MCP|Github|search_repositories")
description = box.describe()
If you want to include all tools provided by a given MCP server, you may use MCP|server_name|* instead of listing individual tools. The above toolbox specification would change to:
box = ToolBox()
box.register_tool_by_name("PythonRunner")
box.register_tool_by_name("Calculator")
box.register_tool_by_name("MCP|Github|*")
description = box.describe()
Tools are included in the description and called using the same mechanism as the native tools and may be used with any language model.