CLAUDE ENGINEERING · LESSON 211 OF 278

Agent SDK Tools, Hooks, MCP, and Permissions

Build custom SDK tools and enforce tool boundaries with hooks, schemas, MCP servers, and permission callbacks.

What you will learn

Build custom SDK tools and enforce tool boundaries with hooks, schemas, MCP servers, and permission callbacks.

In simple words

The Agent SDK supports built-in tools, custom tools, in-process MCP servers, hook callbacks, session control, and permission decisions. Security-critical decisions belong in trusted code and deployment policy.

Visual explanation: Agent SDK Tools, Hooks, MCP, and Permissions

Trace how Tool request becomes Authorized action through sdk policy.

WATCH THE IDEA

Agent SDK Tools, Hooks, MCP, and Permissions

Playing
Tool requestSDK policyAuthorized action
  1. 1Observe: Tool request
  2. 2Transformation: SDK policy
  3. 3Outcome: Authorized action

Observe: Tool request. Trace how Tool request becomes Authorized action through sdk policy.

The diagram highlights Tool request, SDK policy, Authorized action. Use the labels to trace the main relationship from left to right.

Real-world example: Operational AI decision

A team applies agent sdk tools, hooks, mcp, and permissions to a real business workflow.

What the team decides: SDK flexibility increases the need for explicit authorization and observability.

Risk to avoid: A strong technical concept still needs measurement, safeguards, and ownership in production.

Technical explanation

The Agent SDK supports built-in tools, custom tools, in-process MCP servers, hook callbacks, session control, and permission decisions. Security-critical decisions belong in trusted code and deployment policy.

Python and implementation examples

Use these examples to connect the concept to working code. Package-based examples assume the named library is installed in your own environment.

Define a typed Agent SDK tool

python
from typing import Any
from claude_agent_sdk import tool

@tool("greet", "Greet a user", {"name": str})
async def greet(args: dict[str, Any]) -> dict[str, Any]:
    return {
        "content": [
            {"type": "text", "text": f"Hello, {args['name']}!"}
        ]
    }

A tool description helps the model choose the tool, while trusted application code still owns permission and security decisions.

Common misconception

This concept is not a guarantee of a correct outcome by itself. Its value depends on suitable evidence, careful implementation, and evaluation against the real task.

QUICK QUIZ

Which control should decide whether a custom SDK tool is actually allowed to execute?

Practical application

SDK flexibility increases the need for explicit authorization and observability.

Key takeaway

SDK flexibility increases the need for explicit authorization and observability.

Next concept

Continue with Agent SDK Checkpointing, Cost, and Observability.

Engineering view

SDK flexibility increases the need for explicit authorization and observability.

Internals view

Build custom SDK tools and enforce tool boundaries with hooks, schemas, MCP servers, and permission callbacks. The Agent SDK supports built-in tools, custom tools, in-process MCP servers, hook callbacks, session control, and permission decisions. Security-critical decisions belong in trusted code and deployment policy.

Architecture view

Consider the Tool request → SDK policy → Authorized action flow, and make the system's inputs, checks, and outcomes explicit.

Was this lesson helpful?

Lesson discussion

Comments are reviewed before publication. Keep discussion focused on learning and do not post private information.

Loading discussion…

Your quiz answer and current lesson are saved on this device. Sign in to explore account-backed learning features.

Content version 1 · Last reviewed 2026-10-16