---
title: "Tools and how to extend them"
description: "The Autohand Code CLI ships a built-in tool catalog that the agent can call — filesystem, shell, git, web, notebooks, and plan-mode actions. Tools live in the CLI, not in the SDK. The SDKs reference tools by string name and expose two ways to extend the catalog: MCP servers and skills."
sidebar:
  label: "Build custom tools"
seo:
  title: "Tools and how to extend them | Autohand Code Agent SDK"
  description: "The Autohand Code CLI’s built-in tool catalog, how to restrict it per-agent, and how to extend it with MCP servers and skills with SDK startup options."
---

## Built-in tool catalog [#built-in-catalog]

Tool names are strings. They appear on `tool_start` / `tool_end` events and in the startup tool filters. The catalog ships with the CLI; the SDKs do not need a typed enum.

- **Filesystem**: `read_file`, `write_file`, `append_file`, `apply_patch`, `search_replace`, `create_directory`, `delete_path`, `rename_path`, `copy_path`, `list_tree`, `file_stats`
- **Search**: `find_grep`, `fff_find`
- **Shell**: `run_command`, `shell`
- **Git**: `git_status`, `git_diff`, `git_log`, `git_branch`, `git_add`, `git_commit`, `git_checkout`, `git_switch`, `git_merge`, `git_rebase`, `git_stash`, `git_reset`, `git_push`, `git_pull`, `git_fetch`, `git_apply_patch`, `git_worktree_list`, `git_worktree_add`
- **Web**: `web_search`, `fetch_url`
- **Notebook**: `notebook_edit`
- **Plan mode and tasks**: `plan`, `exit_plan_mode`, `todo_write`

Use `search_replace`, `apply_patch`, or `write_file` to edit files. Query the running CLI’s tool registry for the catalog available in your session.

## Restrict the tool surface for an agent [#restrict-tools]

Set tool filters before starting the CLI. A nonempty allowlist limits the tools offered to the model. A matching denial takes precedence. Each entry is a tool name or an argument pattern such as `run_command(git:*)`.

```ts title="TypeScript"
const sdk = new AutohandSDK({
  cwd: '.',
  allowedTools: ['read_file', 'list_tree', 'git_diff'],
  disallowedTools: ['run_command'],
});
```

```python title="Python"
sdk = AutohandSDK(
    cwd=".",
    allowed_tools=["read_file", "list_tree", "git_diff"],
    disallowed_tools=["run_command"],
)
```

```go title="Go"
sdk := autohand.NewSDK(&autohand.Config{
    CWD:             ".",
    AllowedTools:    []string{"read_file", "list_tree", "git_diff"},
    DisallowedTools: []string{"run_command"},
})
```

```java title="Java"
var sdk = new AutohandSDK(SDKConfig.builder()
    .cwd(".")
    .allowedTools(List.of("read_file", "list_tree", "git_diff"))
    .disallowedTools(List.of("run_command"))
    .build());
```

## Route tool events into your app [#route-tool-events]

Use the event stream to log, audit, or reflect tool execution in your UI. Tool name and parameters are present on `tool_start`; output deltas arrive on `tool_update`; final output is on `tool_end`.

```ts title="TypeScript"
for await (const event of sdk.streamPrompt({ message: prompt })) {
  if (event.type === 'tool_start') {
    audit.log({ at: 'tool.start', tool: event.toolName, params: event.params });
  }
  if (event.type === 'tool_end') {
    audit.log({ at: 'tool.end', tool: event.toolName, ok: !event.error });
  }
}
```

```python title="Python"
async for event in sdk.stream_prompt(prompt):
    t = event["type"]
    if t == "tool_start":
        audit.log("tool.start", tool=event.get("tool_name"), params=event.get("params"))
    elif t == "tool_end":
        audit.log("tool.end", tool=event.get("tool_name"), ok=not event.get("error"))
```

## Extend the catalog with MCP servers [#extend-with-mcp]

The Model Context Protocol lets you mount external tool servers into the agent. Each MCP server contributes its own tools, which then appear alongside the built-ins on the same allow/deny lists.

See [Connect to external tools with MCP](/agent-sdk/tools/mcp) for the full setup, including auth and per-server scoping.

## Extend behaviour with skills [#extend-with-skills]

Skills are reusable prompt-and-context bundles installed under `~/.autohand/skills/`. They give the agent a named workflow it can invoke (e.g. `/skill release-readiness`) without changing the tool catalog. Pass `skill_refs` (Python) or the equivalent on other SDKs to declare which skills the agent should know about.

```python title="Python"
from autohand_sdk import AutohandSDK

sdk = AutohandSDK(
    cwd=".",
    skill_refs=[
        "typescript",                                # built-in skill
        "./skills/release-readiness/SKILL.md",        # local file
        {"name": "api", "path": "/abs/path/SKILL.md"},  # named
    ],
)
```

```ts title="TypeScript"
import { AutohandSDK } from '@autohandai/agent-sdk';

const sdk = new AutohandSDK({
  cwd: '.',
  skills: ['typescript', './skills/release-readiness/SKILL.md'],
});
```

## Best practices

- Default to a small `allowList`. Reach for the full catalog only when the job actually needs it.
- Pair `bash` with explicit guardrails in the system prompt (“do not delete files”, “do not modify migrations”).
- Use MCP for org-specific tools (internal APIs, ticket systems). Keep the SDK’s tool surface stable; let MCP grow.
- Use skills for reusable workflows that span multiple prompts (“run release readiness”).
- Audit `tool_start` / `tool_end` for every production run. The data is cheap to capture and invaluable when something goes wrong.
