add-agent-tool

Add a new LangChain tool to the Medox ReAct agent. Use when creating a new tool file, registering it in the graph, and writing its test.

14 stars

Best use case

add-agent-tool is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Add a new LangChain tool to the Medox ReAct agent. Use when creating a new tool file, registering it in the graph, and writing its test.

Teams using add-agent-tool should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/add-agent-tool/SKILL.md --create-dirs "https://raw.githubusercontent.com/spideystreet/medox/main/.claude/skills/add-agent-tool/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/add-agent-tool/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How add-agent-tool Compares

Feature / Agentadd-agent-toolStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Add a new LangChain tool to the Medox ReAct agent. Use when creating a new tool file, registering it in the graph, and writing its test.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Skill: Add a New Agent Tool

## Steps

1. **Create the tool file** at `src/medox/agent/tools/tool_<name>.py`:
   ```python
   """One-line description of the data source and lookup strategy."""

   from langchain_core.tools import tool
   from medox.pipeline.config_pipeline import PipelineSettings

   @tool
   def <tool_name>(<param>: str) -> str:
       """
       <What this tool does — written for the LLM, not a human developer.>

       Include:
       - What the parameter means and expected format
       - Example values or class names the LLM should pass
       - What the tool returns and how to interpret it

       Example: pass 'ANTIVITAMINES K' for warfarine, 'STATINES' for simvastatine.
       """
       settings = PipelineSettings()
       # ... implementation
   ```

2. **Register the tool** in `src/medox/agent/graph_agent.py`:
   - Add the import
   - Add to the `tools = [...]` list passed to `build_agent()`

3. **Docstring rules** (critical — the LLM uses this to decide when/how to call the tool):
   - Written in English
   - Explain *when* to use this tool vs other tools
   - Give concrete input examples (especially for ANSM class names)
   - Describe the return format

4. **Write the test** at `tests/agent/test_tool_<name>.py`:
   ```python
   def test_<tool_name>_returns_expected():
       result = <tool_name>.invoke({"<param>": "<known_value>"})
       assert "<expected_substring>" in result

   def test_<tool_name>_handles_unknown():
       result = <tool_name>.invoke({"<param>": "nonexistent_xyz"})
       assert result  # returns graceful message, not exception
   ```

5. **Update `.claude/rules/agent.md`** — add the tool to the tools table.

6. **Validate**:
   ```bash
   uv run pytest tests/agent/test_tool_<name>.py -v
   uv run pytest tests/agent/ -v
   ```

## Rules

- Tool file name: `tool_<name>.py` — matches the `@tool` function name
- One `@tool` per file
- Never raise exceptions — return a descriptive string on error
- Requires Docker stack running for ChromaDB/PostgreSQL tools

Related Skills

We are still matching the closest adjacent skills for this page. In the meantime, continue through the full directory.