Register and share your invite link to earn from video plays and referrals.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
Joined May 2026
258 Following    225 Followers
# Practical ways to use the Claude Agent SDK ๐Ÿ”ง Define your internal APIs, databases, and domain logic with `@tool` and let Claude call them. Custom Tools lets you define your own functions as in-process MCP servers using the `@tool` decorator, making them callable by Claude during conversations. ๐Ÿ“Œ Title: Providing Custom Tools to Claude ๐Ÿ”— URL: ๐Ÿงฉ Overview Define tools with `@tool` (Python) / `tool()` (TypeScript) specifying name, description, schema, and handler. Wrap with `create_sdk_mcp_server` and pass to `mcp_servers`. Annotate side-effect-free tools with `readOnlyHint: true` for parallel execution. ๐Ÿ›  How to use it Define tools with `@tool` (Python) / `tool()` (TypeScript) specifying name, description, schema, and handler. Wrap with `create_sdk_mcp_server` and pass to `mcp_servers={"weather": server}`. Tools are exposed to Claude as `mcp__weather__get_temperature`. ๐Ÿ— Practical usage - Define internal APIs (customer info, inventory, order status) as `@tool` and build agents that respond to natural language queries. - Add `readOnlyHint: true` to read-only tools for parallel execution and lower latency. - Catch exceptions in handlers and return `is_error=True` so the agent loop continues and Claude retries or tries alternatives. - Return chart images via `image` blocks (base64) for Claude to analyze visually. ๐Ÿ’ก Use cases ๐Ÿข Natural language access to internal APIs ๐Ÿ“Š Chart generation + image analysis pipeline ๐Ÿ”„ Fault-tolerant autonomous retry โš ๏ธ Watch out Uncaught exceptions in handlers crash the entire `query()`. Always handle errors. Use `tools: ["Read","Grep"]` to restrict which built-in tools are available. #ClaudeAgentSDK# #AI#
Show more