Skip to content

Commit fbaa33e

Browse files
committed
chore: auto-document Tools
1 parent 060d715 commit fbaa33e

File tree

8 files changed

+92
-43
lines changed

8 files changed

+92
-43
lines changed

docs/configuration/toolsets/agent-management.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ agents:
1919
2020
## Available Tools
2121
22-
| Tool | Description |
23-
|------|-------------|
24-
| `create_worker_agent` | Create a new worker agent |
25-
| `add_agent` | Add an agent to the pool |
26-
| `add_team` | Create a new team |
27-
| `connect_nodes` | Connect agents in the pool |
22+
```python exec="true"
23+
from agentpool_toolsets.builtin import AgentManagementTools
24+
from agentpool.docs.utils import generate_tool_docs
25+
26+
toolset = AgentManagementTools()
27+
print(generate_tool_docs(toolset))
28+
```
2829

2930
## Tool Selection
3031

docs/configuration/toolsets/code.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ agents:
1717
- type: code
1818
```
1919
20+
## Available Tools
21+
22+
```python exec="true"
23+
from agentpool_toolsets.builtin.code import CodeTools
24+
from agentpool.docs.utils import generate_tool_docs
25+
26+
toolset = CodeTools()
27+
print(generate_tool_docs(toolset))
28+
```
29+
2030
## Configuration Reference
2131

2232
/// mknodes

docs/configuration/toolsets/execution.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,13 @@ Execute on remote machines via SSH or other protocols.
5555
5656
## Available Tools
5757
58-
| Tool | Description |
59-
|------|-------------|
60-
| `execute_code` | Execute code in a specific language |
61-
| `execute_command` | Run shell commands |
62-
| `start_process` | Start a background process |
63-
| `get_process_output` | Get output from a running process |
64-
| `wait_for_process` | Wait for process completion |
65-
| `kill_process` | Terminate a running process |
58+
```python exec="true"
59+
from agentpool_toolsets.builtin.execution_environment import ExecutionEnvironmentTools
60+
from agentpool.docs.utils import generate_tool_docs
61+
62+
toolset = ExecutionEnvironmentTools()
63+
print(generate_tool_docs(toolset))
64+
```
6665

6766
## Tool Selection
6867

docs/configuration/toolsets/file-access.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,13 @@ toolsets:
6161

6262
## Available Tools
6363

64-
The toolset provides these tools to agents:
65-
66-
| Tool | Description |
67-
|------|-------------|
68-
| `list_directory` | List files with glob patterns and filtering |
69-
| `read_file` | Read file contents (text or binary/images) |
70-
| `write_file` | Write content to files |
71-
| `edit_file` | Smart find-and-replace editing |
72-
| `delete_path` | Delete files or directories |
73-
| `grep` | Search file contents with regex |
74-
| `agentic_edit` | AI-powered file editing |
75-
| `download_file` | Download files from URLs |
64+
```python exec="true"
65+
from agentpool_toolsets.fsspec_toolset import FSSpecTools
66+
from agentpool.docs.utils import generate_tool_docs
67+
68+
toolset = FSSpecTools()
69+
print(generate_tool_docs(toolset))
70+
```
7671

7772
## Configuration Reference
7873

docs/configuration/toolsets/subagent.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ agents:
1919
2020
## Available Tools
2121
22-
| Tool | Description |
23-
|------|-------------|
24-
| `list_available_nodes` | List agents available for delegation |
25-
| `delegate_to` | Delegate a task to another agent |
26-
| `ask_agent` | Ask another agent a question |
22+
```python exec="true"
23+
from agentpool_toolsets.builtin.subagent_tools import SubagentTools
24+
from agentpool.docs.utils import generate_tool_docs
25+
26+
toolset = SubagentTools()
27+
print(generate_tool_docs(toolset))
28+
```
2729

2830
## Configuration Reference
2931

docs/configuration/toolsets/user-interaction.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ agents:
1919
2020
## Available Tools
2121
22-
| Tool | Description |
23-
|------|-------------|
24-
| `ask_user` | Ask the user a question |
25-
| `show_message` | Display a message to the user |
26-
| `confirm` | Request user confirmation |
22+
```python exec="true"
23+
from agentpool_toolsets.builtin import UserInteractionTools
24+
from agentpool.docs.utils import generate_tool_docs
25+
26+
toolset = UserInteractionTools()
27+
print(generate_tool_docs(toolset))
28+
```
2729

2830
## Configuration Reference
2931

docs/configuration/toolsets/vfs.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ agents:
3232
3333
## Available Tools
3434
35-
| Tool | Description |
36-
|------|-------------|
37-
| `vfs_list` | List contents of a resource path |
38-
| `vfs_read` | Read content from a resource |
39-
| `vfs_info` | Get information about configured resources |
35+
```python exec="true"
36+
from agentpool_toolsets.vfs_toolset import VFSTools
37+
from agentpool.docs.utils import generate_tool_docs
38+
39+
toolset = VFSTools()
40+
print(generate_tool_docs(toolset))
41+
```
4042

4143
## Usage Examples
4244

src/agentpool/docs/utils.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,41 @@ def check_docs_for_union(
232232
return missing_docs, extra_docs
233233

234234

235+
def _strip_docstring_sections(description: str) -> str:
236+
"""Strip Args/Returns/Raises sections from a docstring, keeping only the summary.
237+
238+
Args:
239+
description: The full docstring
240+
241+
Returns:
242+
Just the summary/description part without parameter documentation
243+
"""
244+
lines = description.split("\n")
245+
result = []
246+
in_section = False
247+
248+
for line in lines:
249+
stripped = line.strip()
250+
# Check if we're entering a standard docstring section
251+
if stripped in ("Args:", "Arguments:", "Returns:", "Raises:", "Yields:", "Note:"):
252+
in_section = True
253+
continue
254+
# Check if we're in a section (indented content after section header)
255+
if in_section:
256+
# If line is empty or still indented, skip it
257+
if not stripped or line.startswith(" ") or line.startswith("\t"):
258+
continue
259+
# Non-indented non-empty line means new content
260+
in_section = False
261+
result.append(line)
262+
263+
# Clean up trailing empty lines
264+
while result and not result[-1].strip():
265+
result.pop()
266+
267+
return "\n".join(result)
268+
269+
235270
def tool_to_markdown(tool: Tool) -> str:
236271
"""Generate markdown documentation for a single tool.
237272
@@ -244,8 +279,11 @@ def tool_to_markdown(tool: Tool) -> str:
244279
lines = [f"### `{tool.name}`", ""]
245280

246281
if tool.description:
247-
lines.append(tool.description)
248-
lines.append("")
282+
# Strip Args/Returns sections since we have a parameters table
283+
desc = _strip_docstring_sections(tool.description)
284+
if desc:
285+
lines.append(desc)
286+
lines.append("")
249287

250288
# Get parameters from schema
251289
schema = tool.schema["function"]

0 commit comments

Comments
 (0)