What this thread does
Do first: Import createTool from @cline/sdk and z from zod; define the schema and handler, then register the result.
Short answer
The current SDK guide separates tool definition from registration. Its May 13, 2026 announcement describes the shared runtime as Cline 2.0, but supplies no package version to pin. Use the current custom-tool API rather than an older extension-internal tool interface.
What to do
| Value | Action / meaning |
|---|---|
| @cline/sdk; createTool; zod; z | Import the factory and schema builder; Zod conversion to JSON Schema is automatic. |
| name; description; inputSchema; execute | Required tool parts: unique name, model-facing usage description, argument schema, execution function. |
| snake_case | Recommended naming convention. |
| inputSchema | Accepts Zod or JSON Schema; the documented type inference applies to the Zod factory path. |
| .describe(); z.enum | Describe each property and use enums for fixed choices; descriptions should state constraints. |
| z.enum | Use for fields with a fixed set of values. |
| execute(input, context) | The handler receives typed input plus execution metadata. |
| context.agentId; context.iteration | Execution metadata shown by the guide. |
| context.signal?.aborted; context.abortSignal | The example checks signal?.aborted; the design checklist instead names abortSignal. Confirm the installed context type before implementing cancellation. |
| context.abortSignal | Checklist spelling differs from the example. |
| output; isError: true | Return structured error data. Throwing instead increments the consecutive mistake counter. |
| lifecycle: { completesRun: true } | Optional: successful completion ends the agent loop. |
| cline.start; config.extraTools | Cline Core: pass the defined tool in config.extraTools when starting. |
| new Agent; tools | Agent-level construction: pass an array of tool definitions as tools. |
| AgentPlugin; manifest.capabilities: ["tools"]; setup(api); api.registerTool | Plugin route: declare tools capability and register each definition in setup. |
| timezone; z.string().optional(); UTC | Example only: timezone is an optional string; the handler uses UTC when absent. This is not an SDK-wide default. |
| get_current_time; z.object | The sample names a tool and constructs its input object schema; these are application choices. |
| prompt; iso | The start call supplies a prompt; the example handler returns an ISO timestamp. |
| Cline 2.0; 2026-05-13 | Runtime announcement context; not a stated @cline/sdk package version. |
A minimal Cline Core example, using an existing cline instance:
import { createTool } from "@cline/sdk"
import { z } from "zod"
const tool = createTool({name: "get_current_time", description: "Get the current time", inputSchema: z.object({timezone: z.string().optional().describe("IANA timezone (e.g., 'America/New_York'). Defaults to UTC.")}), async execute(input) { return {iso: new Date().toISOString(), timezone: input.timezone ?? "UTC"} }})
await cline.start({prompt: "Get the current time", config: {extraTools: [tool]}})
Use the registration route for your runtime; they are alternatives. Return structured JSON when practical and describe application-specific constraints.
Limits and open questions
The page states no universal timeout, input-size limit, or package version. Its numeric schema and timezone values are examples, not SDK-wide defaults. Cancellation property names disagree within the guide; inspect your installed type instead of treating them as aliases. Review the description and handler independently before exposing the tool to an agent.
Not for: Cline IDE MCP server configuration or Claude Agent SDK tools.
Sources
- Creating Custom Tools, Cline.
- Introducing Cline SDK: the upgraded agent runtime, Renee Huang, 2026-05-13.
Checked
2026-11-17; read Creating Custom Tools, Introducing Cline SDK: the upgraded agent runtime; no command was run.
Started from a post by @Cline, packaged by the editor. Original post