-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add Anthropic Claude integration #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add @anthropic-ai/sdk ^0.52.0 to the peer dependencies catalog and package.json to enable Anthropic Claude integration. The dependency is marked as optional so users only need to install it when they intend to use the toAnthropic() conversion methods.
Implement toAnthropic() conversion methods on both BaseTool and Tools classes to enable seamless integration with the Anthropic Claude SDK. The method converts StackOne tools to the Anthropic Tool format with: - name: tool identifier - description: tool description for Claude - input_schema: JSON Schema with type, properties, and required fields Uses the official Tool type from @anthropic-ai/sdk/resources for type safety and API compatibility. Relates to #207
Add comprehensive tests for both BaseTool.toAnthropic() and Tools.toAnthropic() methods to verify correct conversion to Anthropic's Tool format. Tests verify: - Tool name and description are correctly mapped - input_schema.type is set to 'object' - Properties are correctly transferred - Array conversion for Tools collection works properly Relates to #207
Add anthropic-integration.ts demonstrating how to use StackOne tools with Anthropic's Claude API. The example shows: - Initialising StackOneToolSet with account configuration - Fetching HRIS tools via MCP - Converting tools to Anthropic format using toAnthropic() - Creating messages with tool calls using claude-haiku-4-5-20241022 - Verifying tool_use blocks in the response Also adds @anthropic-ai/sdk as a dev dependency in the examples package.json. Closes #207
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 7 files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds seamless integration with Anthropic's Claude API by implementing toAnthropic() conversion methods for StackOne tools. The implementation follows the same patterns established for OpenAI integration, with type-safe, optional peer dependency handling.
Key Changes
- Added
toAnthropic()methods toBaseToolandToolsclasses for converting tool definitions to Anthropic's format - Added
@anthropic-ai/sdkas an optional peer dependency with type-only imports - Comprehensive test coverage for both single tool and collection conversions
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/tool.ts |
Implements toAnthropic() methods on BaseTool and Tools classes, converting tool schemas to Anthropic's input_schema format |
src/tool.test.ts |
Adds comprehensive test coverage for both BaseTool.toAnthropic() and Tools.toAnthropic() methods |
pnpm-workspace.yaml |
Adds @anthropic-ai/sdk v0.52.0 to peer dependency catalog |
pnpm-lock.yaml |
Updates lock file with Anthropic SDK dependency resolution |
package.json |
Adds @anthropic-ai/sdk as optional peer dependency following existing pattern |
examples/package.json |
Adds @anthropic-ai/sdk to examples for demonstration purposes |
examples/anthropic-integration.ts |
Provides working example of using StackOne tools with Claude API |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // Create a message with tool calls | ||
| const response = await anthropic.messages.create({ | ||
| model: 'claude-haiku-4-5-20241022', |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The model name claude-haiku-4-5-20241022 appears to be incorrect. Based on Anthropic's model naming conventions, this should likely be claude-3-5-haiku-20241022 (Claude 3.5 Haiku from October 2024). There is no publicly documented Claude 4 or Claude 4.5 model as of the knowledge cutoff.
| model: 'claude-haiku-4-5-20241022', | |
| model: 'claude-3-5-haiku-20241022', |
|
@ryoppippi conflict on this one |
Resolved conflicts by keeping both Anthropic and OpenAI Responses API methods: - Added toAnthropic() alongside existing toOpenAIResponses() - Both BaseTool and Tools classes now support both conversion formats - All tests passing (306 tests) Changes from main: - Reorganised .claude/ structure (skills → rules) - Added OpenAI Responses API support with strict mode - Enhanced MSW handlers organisation - Updated oxlint configuration
|
@glebedel fixed! |
glebedel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
Add
toAnthropic()conversion methods to enable seamless integration with Anthropic's Claude API, allowing StackOne tools to be used directly with Claude models.What Changed
@anthropic-ai/sdkas optional peer dependencyBaseTool.toAnthropic()method for single tool conversionTools.toAnthropic()method for collection conversionUsage
Closes #207
Summary by cubic
Add toAnthropic() converters to export StackOne tools to Anthropic’s Tool format, enabling direct use with Claude’s messages API. Includes an example and tests; adds @anthropic-ai/sdk as an optional peer dependency.
New Features
Dependencies
Written for commit b4cc8f9. Summary will update automatically on new commits.