Skip to content

Commit 807f168

Browse files
committed
docs(readme): simplify Claude Agent SDK integration example
Update the README to showcase the simplified toClaudeAgentSdk() API. The new example is much shorter and easier to follow: - Removed manual tool wrapping with Zod schemas - Removed createSdkMcpServer() setup code - Single method call now handles all conversion
1 parent 39a5e7c commit 807f168

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

README.md

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -281,35 +281,17 @@ npm install @stackone/ai @anthropic-ai/claude-agent-sdk zod # or: yarn/pnpm/bun
281281
```
282282

283283
```typescript
284-
import { query, tool, createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk";
285-
import { z } from "zod";
284+
import { query } from "@anthropic-ai/claude-agent-sdk";
286285
import { StackOneToolSet } from "@stackone/ai";
287286

288287
const toolset = new StackOneToolSet({
289288
baseUrl: "https://api.stackone.com",
290289
accountId: "your-account-id",
291290
});
292291

292+
// Fetch tools and convert to Claude Agent SDK format
293293
const tools = await toolset.fetchTools();
294-
const employeeTool = tools.getTool("bamboohr_get_employee");
295-
296-
// Create a Claude Agent SDK tool from the StackOne tool
297-
const getEmployeeTool = tool(
298-
employeeTool.name,
299-
employeeTool.description,
300-
{ id: z.string().describe("The employee ID") },
301-
async (args) => {
302-
const result = await employeeTool.execute(args);
303-
return { content: [{ type: "text", text: JSON.stringify(result) }] };
304-
}
305-
);
306-
307-
// Create an MCP server with the StackOne tool
308-
const mcpServer = createSdkMcpServer({
309-
name: "stackone-tools",
310-
version: "1.0.0",
311-
tools: [getEmployeeTool],
312-
});
294+
const mcpServer = await tools.toClaudeAgentSdk();
313295

314296
// Use with Claude Agent SDK query
315297
const result = query({

0 commit comments

Comments
 (0)