Skip to content
kagent 1.0 is available as an alpha release. To read its documentation, see the 1.x docs.

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

kagent mcp add-tool

Page as Markdown

Add a new MCP tool to your project.

Generate a new MCP tool that will be automatically loaded by the server.

This command creates a new tool file in src/tools/ with a generic template. The tool will be automatically discovered and loaded when the server starts.

Each tool is a Python file containing a function decorated with @mcp.tool(). The function should use the @mcp.tool() decorator from FastMCP.

kagent mcp add-tool [tool-name] [flags]

Flags:

  • -d, --description string - Tool description
  • -f, --force - Overwrite existing tool file
  • -h, --help - help for add-tool
  • -i, --interactive - Interactive tool creation
  • --project-dir string - Project directory (default: current directory)

Global Flags:

  • --config string - config file (default is $HOME/.kagent/config.yaml) (default “$HOME/.kagent/config.yaml”)
  • --kagent-url string - KAgent URL (default “http://localhost:8083”)
  • -n, --namespace string - Namespace (default “kagent”)
  • -o, --output-format string - Output format (default “table”)
  • --timeout duration - Timeout (default 5m0s)
  • -v, --verbose - Verbose output

Example

kagent mcp add-tool weather
kagent mcp add-tool database --description "Database operations tool"
kagent mcp add-tool weather --force  # Overwrite existing tool