claude_agent 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d11f6fa8fa6ecc4b00e0bb6f7913582d0ac8675f649f2d5b423306660a44247
4
- data.tar.gz: 1c7259588ea2b823ad06c7f263830418a590b5488c7db3d9d825b3e46b31495a
3
+ metadata.gz: 72db3aeea7a724d0271a3fc8bb0bd7900425a34e7114e526e9bfe8bbbe26e19f
4
+ data.tar.gz: a31e9321dc56507d0a05d8319e50fded02aaa420a9709a0970a298826ea2f4ad
5
5
  SHA512:
6
- metadata.gz: e57643b8293c0cba79fb96322daa1c8fd08a068664f63bad5a6787f9731e60232ff0ee806698ff79707c4a000dd600bfc1e459ea9a0933e7685e5b5fefd87911
7
- data.tar.gz: 6ac435262b2489ef696db91db6440e8df9f8000e09a46b97cc80decdda1b04cedfcd561a6d56e8b09aa8d373fa223f1ecdad2ff08f82ba9ea350375dd5772eed
6
+ metadata.gz: 54d586a6a4e368adf4b64ec8afdbf4b04ad165473e81bcf8e0c244c7c04ac5c524b6c1186e34dd7bf6c31cc3b521da6d5526b187a30d147c3839ba5b708056ae
7
+ data.tar.gz: 4af34d4756c9559570ea9c8d0ed9819ae98827773eed4332d9cc7bc50c8b5edc6584c0ee25fbfa197c3bc79513acace10ee88ec3bf1674141afcfe213ead2f02
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: spec
3
+ description: Manage the SDK feature parity specification. Use 'update' to regenerate SPEC.md from current implementations, or 'complete' to implement missing features.
4
+ argument-hint: [update|complete]
5
+ disable-model-invocation: true
6
+ allowed-tools: Bash, Read, Glob, Grep, Write, Edit, TodoWrite, Task, AskUserQuestion, EnterPlanMode
7
+ ---
8
+
9
+ # SDK Feature Parity Management
10
+
11
+ Manage the feature parity specification for the TypeScript, Python, and Ruby Claude Agent SDKs.
12
+
13
+ ## Reference SDKs
14
+
15
+ Ensure reference SDKs are current before starting any workflow:
16
+
17
+ ```bash
18
+ bin/update-reference-sdks
19
+ ```
20
+
21
+ This clones/updates:
22
+ - Python SDK from GitHub -> `vendor/claude-agent-sdk-python`
23
+ - TypeScript SDK from npm -> `vendor/claude-agent-sdk-npm`
24
+ - TypeScript SDK repo from GitHub -> `vendor/claude-agent-sdk-typescript` (changelog/releases)
25
+
26
+ ## Key Source Files
27
+
28
+ **TypeScript SDK (Primary Reference)**
29
+ - `vendor/claude-agent-sdk-npm/sdk.d.ts` - Complete API surface with all types
30
+ - `vendor/claude-agent-sdk-typescript/CHANGELOG.md` - Release changelog
31
+
32
+ **Python SDK**
33
+ - `vendor/claude-agent-sdk-python/src/claude_agent_sdk/types.py` - Type definitions
34
+ - `vendor/claude-agent-sdk-python/src/claude_agent_sdk/_internal/` - Internal implementation
35
+
36
+ **Ruby SDK (This Repository)**
37
+ - `lib/claude_agent/` - All implementation files
38
+
39
+ ## Mode Selection
40
+
41
+ Based on the first argument:
42
+
43
+ - **update**: Follow the workflow in [commands/update.md](commands/update.md)
44
+ - **complete**: Follow the workflow in [commands/complete.md](commands/complete.md)
45
+ - If no argument or unrecognized: ask the user which mode they want
@@ -1,21 +1,12 @@
1
- ---
2
- description: Implement missing Ruby SDK features identified in SPEC.md to achieve full parity with TypeScript/Python SDKs
3
- allowed-tools: Bash, Read, Glob, Grep, Write, Edit, TodoWrite, Task, AskUserQuestion, EnterPlanMode
4
- ---
5
-
6
1
  # Complete SDK Feature Parity
7
2
 
8
- You are implementing missing features in the Ruby SDK to achieve full parity with the official TypeScript and Python Claude Agent SDKs.
3
+ Implement missing features in the Ruby SDK to achieve full parity with the official TypeScript and Python Claude Agent SDKs.
9
4
 
10
5
  ## Step 1: Identify Missing Features
11
6
 
12
- Read SPEC.md and identify all features where the Ruby SDK shows ❌ (not implemented):
13
-
14
- ```
15
- Read SPEC.md
16
- ```
7
+ Read SPEC.md and identify all features where the Ruby SDK is not implemented.
17
8
 
18
- Create a prioritized list of missing features:
9
+ Create a prioritized list:
19
10
  1. **High Priority** - Features implemented in BOTH TypeScript and Python SDKs
20
11
  2. **Medium Priority** - Features only in TypeScript SDK (Python also missing)
21
12
  3. **Low Priority** - TypeScript-only features that may be JS-specific
@@ -24,31 +15,23 @@ Use TodoWrite to track the features to implement.
24
15
 
25
16
  ## Step 2: Research Each Feature
26
17
 
27
- For each missing feature, gather complete context before planning:
18
+ Gather complete context before planning:
28
19
 
29
20
  ### 2a. Official Documentation
30
21
 
31
- Use the `claude-code-guide` agent to understand the feature's intended behavior:
22
+ Use the `claude-code-guide` agent to understand each feature's intended behavior:
32
23
 
33
24
  ```
34
25
  Task(subagent_type: "claude-code-guide", prompt: "How does [feature] work in the Claude Agent SDK? What are all the options, behaviors, and edge cases?")
35
26
  ```
36
27
 
37
- ### 2b. TypeScript Implementation
38
-
39
- Read the TypeScript type definitions to understand the API surface:
40
- - `vendor/claude-agent-sdk-npm/sdk.d.ts`
41
-
42
- ### 2c. Python Implementation (if available)
28
+ ### 2b. Reference Implementations
43
29
 
44
- If Python has the feature, read their implementation for patterns:
45
- - `vendor/claude-agent-sdk-python/src/claude_agent_sdk/types.py`
46
- - `vendor/claude-agent-sdk-python/src/claude_agent_sdk/_internal/`
30
+ Read the TypeScript type definitions and changelog listed in SKILL.md to understand the API surface and when features were added. If Python has the feature, read their implementation for patterns.
47
31
 
48
32
  ## Step 3: Clarify Requirements
49
33
 
50
- Use AskUserQuestion to resolve any ambiguities:
51
-
34
+ Use AskUserQuestion to resolve ambiguities:
52
35
  - Implementation approach choices
53
36
  - Ruby-specific design decisions
54
37
  - Whether certain features should be skipped (e.g., JS-specific)
@@ -56,15 +39,9 @@ Use AskUserQuestion to resolve any ambiguities:
56
39
 
57
40
  ## Step 4: Enter Plan Mode
58
41
 
59
- Enter plan mode to design the implementation:
60
-
61
- ```
62
- EnterPlanMode
63
- ```
64
-
65
- The plan should include:
42
+ Enter plan mode to design the implementation. The plan should include:
66
43
  - Which files to create or modify
67
- - Data structures (use `Data.define` for immutable types)
44
+ - Data structures
68
45
  - Public API design
69
46
  - Test coverage requirements
70
47
  - Any breaking changes or deprecations
@@ -80,26 +57,22 @@ After plan approval, implement each feature:
80
57
  5. Update RBS type signatures in `sig/` directory
81
58
  6. Write unit tests in `test/claude_agent/`
82
59
  7. Write integration tests in `test/integration/` for features that interact with CLI/API
83
- 8. Update SPEC.md to mark feature as
60
+ 8. Update SPEC.md to mark feature as complete
84
61
 
85
62
  ### Testing Requirements
86
63
 
87
64
  - **Unit tests** - For all new types, data structures, and internal logic
88
- - **Integration tests** - Required for anything that:
89
- - Spawns the CLI subprocess
90
- - Sends/receives messages via the control protocol
91
- - Interacts with MCP servers
92
- - Uses file checkpointing or session management
65
+ - **Integration tests** - Required for anything that spawns the CLI subprocess, sends/receives messages via the control protocol, interacts with MCP servers, or uses file checkpointing/session management
93
66
 
94
67
  ## Step 6: Update Specification
95
68
 
96
- After implementing features, run `/spec:update` to refresh SPEC.md with the new implementation status.
69
+ After implementing features, run `/spec update` to refresh SPEC.md with the new implementation status.
97
70
 
98
71
  ## Output
99
72
 
100
73
  Provide a summary of:
101
74
  - Features implemented
102
- - Any features skipped (with reasons)
75
+ - Features skipped (with reasons)
103
76
  - Breaking changes introduced
104
77
  - Test coverage added
105
78
  - Remaining gaps (if any)
@@ -0,0 +1,48 @@
1
+ # Update SDK Specification
2
+
3
+ Update SPEC.md to reflect the current feature parity between the TypeScript, Python, and Ruby Claude Agent SDKs.
4
+
5
+ ## Step 1: Update Reference SDKs
6
+
7
+ Run `bin/update-reference-sdks` to ensure all reference SDKs are current.
8
+
9
+ ## Step 2: Research Official Documentation
10
+
11
+ Use the `claude-code-guide` agent to check for new or updated SDK features:
12
+
13
+ ```
14
+ Task(subagent_type: "claude-code-guide", prompt: "What are all the features and options in the Claude Agent SDK? Include configuration options, hooks, permissions, MCP support, and control protocol methods.")
15
+ ```
16
+
17
+ This helps catch features documented but not yet in SDK source files.
18
+
19
+ ## Step 3: Analyze All Three SDKs
20
+
21
+ Read and compare the key source files listed in SKILL.md. Pay special attention to:
22
+ - TypeScript `sdk.d.ts` as the authoritative API surface
23
+ - TypeScript `CHANGELOG.md` for recently added features
24
+ - Python `types.py` for implementation patterns
25
+ - All Ruby SDK files for current implementation status
26
+
27
+ ## Step 4: Update SPEC.md
28
+
29
+ 1. **Reference Versions** - Update TypeScript SDK version and Python SDK commit
30
+ 2. **Feature Tables** - Update all markers based on current implementations
31
+ 3. **New Features** - Add any new features found in the TypeScript SDK
32
+ 4. **Removed Features** - Remove any deprecated features
33
+
34
+ ## Guidelines
35
+
36
+ - Check every field and option in each SDK
37
+ - TypeScript sdk.d.ts is the authoritative reference
38
+ - Preserve the existing table structure and markdown formatting
39
+ - Always update the reference version info at the top
40
+ - Note significant changes after updating
41
+
42
+ ## Output
43
+
44
+ Provide a brief summary of:
45
+ - SDK versions checked
46
+ - New features added to the spec
47
+ - Features removed from the spec
48
+ - Notable gaps in the Ruby SDK
data/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.0] - 2026-01-31
11
+
12
+ ### Added
13
+ - MCP tool annotations support (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`, `title`) on `MCP::Tool` and `MCP.tool` convenience method (TypeScript SDK v0.2.27 parity)
14
+ - README documentation for `UserMessageReplay`, `HookStartedMessage`, `HookProgressMessage`, `ToolUseSummaryMessage`, `FilesPersistedEvent` message types
15
+ - README documentation for `mcp_reconnect` and `mcp_toggle` client methods
16
+ - README documentation for MCP tool annotations
17
+
18
+ ### Changed
19
+ - Updated SPEC.md to reference TypeScript SDK v0.2.27 and Python SDK v0.1.26
20
+
10
21
  ## [0.6.0] - 2026-01-30
11
22
 
12
23
  ### Added
data/CLAUDE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ClaudeAgent Ruby SDK
2
2
 
3
- Ruby SDK for building autonomous AI agents that interact with Claude Code CLI.
3
+ Ruby SDK for building autonomous AI agents that interact with Claude Code CLI. See [README.md](README.md) for API usage, message types, configuration, and examples.
4
4
 
5
5
  ## Stack
6
6
 
@@ -32,16 +32,6 @@ bin/rbs-validate # Validate RBS signatures
32
32
  bin/release VERSION # Release gem (e.g., bin/release 1.2.0)
33
33
  ```
34
34
 
35
- ## Architecture
36
-
37
- | Component | Purpose |
38
- |-----------------------------|----------------------------------------------------|
39
- | `Query` | One-shot stateless prompts |
40
- | `Client` | Multi-turn bidirectional conversations |
41
- | `ControlProtocol` | Handles handshake, hooks, permissions, MCP routing |
42
- | `Transport::Subprocess` | Spawns CLI, manages stdin/stdout |
43
- | `MCP::Tool` / `MCP::Server` | Custom tool definitions |
44
-
45
35
  ## Conventions
46
36
 
47
37
  - **Immutable data types**: All messages and options use `Data.define`
@@ -50,25 +40,6 @@ bin/release VERSION # Release gem (e.g., bin/release 1.2.0)
50
40
  - **Error hierarchy**: All errors inherit from `ClaudeAgent::Error` with context (exit code, stderr, etc.)
51
41
  - **Protocol flow**: Transport → ControlProtocol → MessageParser → typed message objects
52
42
 
53
- ## Key Patterns
54
-
55
- ```ruby
56
- # One-shot query
57
- result = ClaudeAgent.query("prompt", model: "sonnet")
58
-
59
- # Interactive client
60
- client = ClaudeAgent::Client.new(options)
61
- client.send_message("prompt") { |msg| handle(msg) }
62
-
63
- # Content blocks are polymorphic
64
- message.content.each do |block|
65
- case block
66
- when ClaudeAgent::TextBlock then ...
67
- when ClaudeAgent::ToolUseBlock then ...
68
- end
69
- end
70
- ```
71
-
72
43
  ## Testing Notes
73
44
 
74
45
  - Unit tests in `test/claude_agent/` - run without Claude CLI
data/README.md CHANGED
@@ -5,7 +5,7 @@ Ruby gem for building AI-powered applications with the [Claude Agent SDK](https:
5
5
  ## Requirements
6
6
 
7
7
  - Ruby 3.2+ (uses `Data.define`)
8
- - [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code/getting-started) v2.0.0+
8
+ - [Claude Code CLI](https://code.claude.com/docs/en/getting-started) v2.0.0+
9
9
 
10
10
  ## Installation
11
11
 
@@ -226,6 +226,19 @@ result.errors # Array of error messages (if any)
226
226
  result.permission_denials # Array of SDKPermissionDenial (if any)
227
227
  ```
228
228
 
229
+ ### UserMessageReplay
230
+
231
+ Replayed user messages when resuming a session with existing history:
232
+
233
+ ```ruby
234
+ replay.content # Message content
235
+ replay.uuid # Message UUID
236
+ replay.session_id # Session identifier
237
+ replay.parent_tool_use_id # Parent tool use ID (if tool result)
238
+ replay.replay? # true if this is a replayed message
239
+ replay.synthetic? # true if this is a synthetic message
240
+ ```
241
+
229
242
  ### SystemMessage
230
243
 
231
244
  Internal system events:
@@ -289,6 +302,48 @@ hook_response.stderr # Hook stderr
289
302
  hook_response.exit_code # Exit code
290
303
  ```
291
304
 
305
+ ### HookStartedMessage
306
+
307
+ Hook execution start notification:
308
+
309
+ ```ruby
310
+ hook_started.hook_id # Hook identifier
311
+ hook_started.hook_name # Hook name
312
+ hook_started.hook_event # Hook event type
313
+ ```
314
+
315
+ ### HookProgressMessage
316
+
317
+ Progress during hook execution:
318
+
319
+ ```ruby
320
+ hook_progress.hook_id # Hook identifier
321
+ hook_progress.hook_name # Hook name
322
+ hook_progress.hook_event # Hook event type
323
+ hook_progress.stdout # Hook stdout so far
324
+ hook_progress.stderr # Hook stderr so far
325
+ hook_progress.output # Combined output
326
+ ```
327
+
328
+ ### ToolUseSummaryMessage
329
+
330
+ Summary of tool use for collapsed display:
331
+
332
+ ```ruby
333
+ summary.summary # Human-readable summary text
334
+ summary.preceding_tool_use_ids # Tool use IDs this summarizes
335
+ ```
336
+
337
+ ### FilesPersistedEvent
338
+
339
+ Files persisted to storage during a session:
340
+
341
+ ```ruby
342
+ persisted.files # Array of successfully persisted file paths
343
+ persisted.failed # Array of files that failed to persist
344
+ persisted.processed_at # Timestamp of persistence
345
+ ```
346
+
292
347
  ### AuthStatusMessage
293
348
 
294
349
  Authentication status during login:
@@ -413,6 +468,33 @@ schema: {
413
468
  }
414
469
  ```
415
470
 
471
+ ### Tool Annotations
472
+
473
+ Annotate tools with hints about their behavior:
474
+
475
+ ```ruby
476
+ tool = ClaudeAgent::MCP::Tool.new(
477
+ name: "search",
478
+ description: "Search the web",
479
+ schema: { query: String },
480
+ annotations: {
481
+ readOnlyHint: true, # Tool only reads data, no side effects
482
+ destructiveHint: false, # Tool does not destroy/delete data
483
+ idempotentHint: true, # Repeated calls with same args have same effect
484
+ openWorldHint: true, # Tool interacts with external systems
485
+ title: "Web Search" # Human-readable display name
486
+ }
487
+ ) { |args| "Results for #{args['query']}" }
488
+
489
+ # Or with the convenience method
490
+ tool = ClaudeAgent::MCP.tool(
491
+ "search", "Search the web", { query: String },
492
+ annotations: { readOnlyHint: true, openWorldHint: true }
493
+ ) { |args| "Results" }
494
+ ```
495
+
496
+ All annotation fields are optional hints — omit any that don't apply.
497
+
416
498
  ### Tool Return Values
417
499
 
418
500
  Tools can return various formats:
@@ -622,6 +704,13 @@ result = client.set_mcp_servers({
622
704
  })
623
705
  puts "Added: #{result.added}, Removed: #{result.removed}"
624
706
 
707
+ # Reconnect a disconnected MCP server
708
+ client.mcp_reconnect("my-server")
709
+
710
+ # Enable or disable an MCP server
711
+ client.mcp_toggle("my-server", enabled: false) # Disable
712
+ client.mcp_toggle("my-server", enabled: true) # Re-enable
713
+
625
714
  # Query capabilities
626
715
  client.supported_commands.each { |cmd| puts "#{cmd.name}: #{cmd.description}" }
627
716
  client.supported_models.each { |model| puts "#{model.value}: #{model.display_name}" }
data/SPEC.md CHANGED
@@ -3,11 +3,11 @@
3
3
  This document provides a comprehensive specification of the Claude Agent SDK, comparing feature parity across the official TypeScript and Python SDKs with this Ruby implementation.
4
4
 
5
5
  **Reference Versions:**
6
- - TypeScript SDK: v0.2.25 (npm package)
7
- - Python SDK: v0.1.25 from GitHub (commit 1bf665c)
6
+ - TypeScript SDK: v0.2.27 (npm package)
7
+ - Python SDK: v0.1.26 from GitHub (commit 438ddf7)
8
8
  - Ruby SDK: This repository
9
9
 
10
- **Last Updated:** 2026-01-30
10
+ **Last Updated:** 2026-01-31
11
11
 
12
12
  ---
13
13
 
@@ -424,7 +424,7 @@ Permission handling and updates.
424
424
  |------------------|:----------:|:------:|:----:|---------------------------|
425
425
  | `signal` | ✅ | ✅ | ✅ | Abort signal |
426
426
  | `suggestions` | ✅ | ✅ | ✅ | Permission suggestions |
427
- | `blockedPath` | ✅ | | ✅ | Blocked file path |
427
+ | `blockedPath` | ✅ | | ✅ | Blocked file path |
428
428
  | `decisionReason` | ✅ | ❌ | ✅ | Why permission triggered |
429
429
  | `toolUseID` | ✅ | ❌ | ✅ | Tool call ID |
430
430
  | `agentID` | ✅ | ❌ | ✅ | Subagent ID if applicable |
@@ -474,11 +474,12 @@ Model Context Protocol server support.
474
474
 
475
475
  ### SDK MCP Server
476
476
 
477
- | Feature | TypeScript | Python | Ruby | Notes |
478
- |----------------------|:----------:|:------:|:--------------------:|------------------------|
479
- | `createSdkMcpServer` | ✅ | ❌ | ✅ | Create SDK server |
480
- | `tool()` helper | ✅ | ❌ | ✅ | Create tool definition |
481
- | Tool input schema | ✅ (Zod) | ❌ | ✅ (Hash/JSON Schema) | Schema definition |
477
+ | Feature | TypeScript | Python | Ruby | Notes |
478
+ |----------------------|:----------:|:------:|:--------------------:|--------------------------|
479
+ | `createSdkMcpServer` | ✅ | ❌ | ✅ | Create SDK server |
480
+ | `tool()` helper | ✅ | ❌ | ✅ | Create tool definition |
481
+ | Tool input schema | ✅ (Zod) | ❌ | ✅ (Hash/JSON Schema) | Schema definition |
482
+ | Tool annotations | ✅ | ❌ | ✅ | MCP tool hints (v0.2.27) |
482
483
 
483
484
  ---
484
485
 
@@ -611,6 +612,8 @@ Public API surface for SDK clients.
611
612
  | `accountInfo()` | ✅ | ❌ | ✅ | Get account info |
612
613
  | `rewindFiles()` | ✅ | ✅ | ✅ | Rewind file changes |
613
614
  | `setMcpServers()` | ✅ | ❌ | ✅ | Dynamic MCP servers |
615
+ | `reconnectMcpServer()` | ✅ | ❌ | ✅ | Reconnect MCP server |
616
+ | `toggleMcpServer()` | ✅ | ❌ | ✅ | Enable/disable MCP |
614
617
  | `streamInput()` | ✅ | ✅ | ✅ | Stream user input |
615
618
  | `close()` | ✅ | ✅ | ✅ | Close query/session |
616
619
 
@@ -663,9 +666,12 @@ Public API surface for SDK clients.
663
666
  - v0.2.19 adds `HookStartedMessage`, `HookProgressMessage`, and `ToolUseSummaryMessage`
664
667
  - v0.2.25 adds `SDKFilesPersistedEvent` message type for file persistence confirmation
665
668
  - v0.2.25 adds `McpClaudeAIProxyServerConfig` (`claudeai-proxy` type) for managed proxy servers
669
+ - v0.2.21 adds `reconnectMcpServer()` and `toggleMcpServer()` query methods
670
+ - v0.2.21 adds `config`, `scope`, `tools` fields and `disabled` status to `McpServerStatus`
671
+ - v0.2.27 adds optional `annotations` support to `tool()` helper for MCP tool hints
666
672
 
667
673
  ### Python SDK
668
- - Full source available (v0.1.25)
674
+ - Full source available (v0.1.26)
669
675
  - Now has `Transport` abstract class and several query control methods
670
676
  - Supports `interrupt()`, `set_permission_mode()`, `set_model()`, `rewind_files()`, `stream_input()`, `close()`, `get_mcp_status()` in query
671
677
  - Client also supports `interrupt()`, `set_permission_mode()`, `set_model()`, `rewind_files()`
@@ -676,6 +682,7 @@ Public API surface for SDK clients.
676
682
  - `excludedCommands` in sandbox now supported
677
683
  - v0.1.25 adds `PostToolUseFailure` hook event support
678
684
  - v0.1.25 adds `permissionDecisionReason` to `PreToolUseHookSpecificOutput`
685
+ - v0.1.26 bumps bundled CLI to v2.1.27 (no new SDK features beyond PostToolUseFailure)
679
686
  - `additionalContext` supported in `UserPromptSubmitHookSpecificOutput`
680
687
  - `PreToolUseHookInput` does not include `tool_use_id` (unlike TypeScript)
681
688
  - `ToolPermissionContext` missing `blockedPath`, `decisionReason`, `toolUseID`, `agentID`
@@ -690,3 +697,4 @@ Public API surface for SDK clients.
690
697
  - `executable`/`executableArgs` marked N/A (JS runtime options not applicable to Ruby)
691
698
  - Added: `FilesPersistedEvent` message type (new in TS v0.2.25)
692
699
  - `claudeai-proxy` MCP server type handled transparently via Hash-based config passthrough (new in TS v0.2.25)
700
+ - Added: MCP tool `annotations` support (new in TS v0.2.27)
@@ -150,8 +150,8 @@ module ClaudeAgent
150
150
  # "Hello, #{args['name']}!"
151
151
  # end
152
152
  #
153
- def self.tool(name, description, schema = {}, &handler)
154
- Tool.new(name: name, description: description, schema: schema, &handler)
153
+ def self.tool(name, description, schema = {}, annotations: nil, &handler)
154
+ Tool.new(name: name, description: description, schema: schema, annotations: annotations, &handler)
155
155
  end
156
156
 
157
157
  # Convenience method to create a server
@@ -34,16 +34,18 @@ module ClaudeAgent
34
34
  # end
35
35
  #
36
36
  class Tool
37
- attr_reader :name, :description, :schema, :handler
37
+ attr_reader :name, :description, :schema, :annotations, :handler
38
38
 
39
39
  # @param name [String] Tool name (must be unique within server)
40
40
  # @param description [String] Description of what the tool does
41
41
  # @param schema [Hash] Input schema (simple Ruby types or JSON Schema)
42
+ # @param annotations [Hash, nil] MCP tool annotations (readOnlyHint, destructiveHint, etc.)
42
43
  # @param handler [Proc] Block to execute when tool is called
43
- def initialize(name:, description:, schema: {}, &handler)
44
+ def initialize(name:, description:, schema: {}, annotations: nil, &handler)
44
45
  @name = name.to_s
45
46
  @description = description.to_s
46
47
  @schema = normalize_schema(schema)
48
+ @annotations = annotations
47
49
  @handler = handler || ->(args) { raise "No handler defined for tool #{name}" }
48
50
  end
49
51
 
@@ -60,11 +62,13 @@ module ClaudeAgent
60
62
  # Convert to MCP tool definition format
61
63
  # @return [Hash]
62
64
  def to_mcp_definition
63
- {
65
+ definition = {
64
66
  name: @name,
65
67
  description: @description,
66
68
  inputSchema: @schema
67
69
  }
70
+ definition[:annotations] = @annotations if @annotations.present?
71
+ definition
68
72
  end
69
73
 
70
74
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeAgent
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
data/sig/claude_agent.rbs CHANGED
@@ -967,15 +967,16 @@ module ClaudeAgent
967
967
 
968
968
  # MCP module
969
969
  module MCP
970
- def self.tool: (String name, String description, ?Hash[Symbol, untyped] schema) { (Hash[String, untyped]) -> untyped } -> Tool
970
+ def self.tool: (String name, String description, ?Hash[Symbol, untyped] schema, ?annotations: Hash[Symbol, untyped]?) { (Hash[String, untyped]) -> untyped } -> Tool
971
971
  def self.create_server: (name: String, ?tools: Array[Tool]) -> Server
972
972
 
973
973
  class Tool
974
974
  attr_reader name: String
975
975
  attr_reader description: String
976
976
  attr_reader schema: Hash[Symbol, untyped]
977
+ attr_reader annotations: Hash[Symbol, untyped]?
977
978
 
978
- def initialize: (name: String, description: String, ?schema: Hash[Symbol, untyped]) { (Hash[String, untyped]) -> untyped } -> void
979
+ def initialize: (name: String, description: String, ?schema: Hash[Symbol, untyped], ?annotations: Hash[Symbol, untyped]?) { (Hash[String, untyped]) -> untyped } -> void
979
980
  def call: (Hash[String, untyped] arguments) -> Hash[Symbol, untyped]
980
981
  def to_mcp_definition: () -> Hash[Symbol, untyped]
981
982
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Carr
@@ -34,14 +34,15 @@ executables: []
34
34
  extensions: []
35
35
  extra_rdoc_files: []
36
36
  files:
37
- - ".claude/commands/spec/complete.md"
38
- - ".claude/commands/spec/update.md"
39
37
  - ".claude/rules/conventions.md"
40
38
  - ".claude/rules/git.md"
41
39
  - ".claude/rules/pull-requests.md"
42
40
  - ".claude/rules/releases.md"
43
41
  - ".claude/rules/testing.md"
44
42
  - ".claude/settings.json"
43
+ - ".claude/skills/spec/SKILL.md"
44
+ - ".claude/skills/spec/commands/complete.md"
45
+ - ".claude/skills/spec/commands/update.md"
45
46
  - CHANGELOG.md
46
47
  - CLAUDE.md
47
48
  - LICENSE.txt
@@ -1,95 +0,0 @@
1
- ---
2
- description: Update SPEC.md with latest feature parity comparison across TypeScript, Python, and Ruby SDKs
3
- allowed-tools: Bash, Read, Glob, Grep, Write, Edit, TodoWrite, Task
4
- ---
5
-
6
- # Update SDK Specification Document
7
-
8
- You are updating the SPEC.md file to reflect the current feature parity between the TypeScript, Python, and Ruby Claude Agent SDKs.
9
-
10
- ## Step 1: Update Reference SDKs
11
-
12
- First, ensure the reference SDKs are up to date:
13
-
14
- ```bash
15
- bin/update-reference-sdks
16
- ```
17
-
18
- This clones/updates:
19
- - Python SDK from GitHub → `vendor/claude-agent-sdk-python`
20
- - TypeScript SDK from npm → `vendor/claude-agent-sdk-npm`
21
-
22
- ## Step 2: Research Official Documentation
23
-
24
- Use the `claude-code-guide` agent to check for any new or updated SDK features:
25
-
26
- ```
27
- Task(subagent_type: "claude-code-guide", prompt: "What are all the features and options in the Claude Agent SDK? Include configuration options, hooks, permissions, MCP support, and control protocol methods.")
28
- ```
29
-
30
- This helps catch features that may be documented but not yet in the SDK source files.
31
-
32
- ## Step 3: Analyze All Three SDKs
33
-
34
- Read and compare the following files:
35
-
36
- ### TypeScript SDK (Primary Reference)
37
- - `vendor/claude-agent-sdk-npm/sdk.d.ts` - Complete API surface with all types
38
-
39
- ### Python SDK
40
- - `vendor/claude-agent-sdk-python/src/claude_agent_sdk/types.py` - Type definitions
41
-
42
- ### Ruby SDK (This Repository)
43
- Key files to check:
44
- - `lib/claude_agent/options.rb` - Configuration options
45
- - `lib/claude_agent/messages.rb` - Message types
46
- - `lib/claude_agent/content_blocks.rb` - Content block types
47
- - `lib/claude_agent/types.rb` - Additional types
48
- - `lib/claude_agent/hooks.rb` - Hook types
49
- - `lib/claude_agent/permissions.rb` - Permission types
50
- - `lib/claude_agent/control_protocol.rb` - Control protocol
51
- - `lib/claude_agent/sandbox_settings.rb` - Sandbox config
52
- - `lib/claude_agent/mcp/server.rb` - MCP server
53
- - `lib/claude_agent/mcp/tool.rb` - MCP tools
54
- - `lib/claude_agent/client.rb` - Client class
55
- - `lib/claude_agent/errors.rb` - Error types
56
-
57
- ## Step 4: Update SPEC.md
58
-
59
- Update the existing SPEC.md file with:
60
-
61
- 1. **Reference Versions** - Update TypeScript SDK version and Python SDK commit
62
- 2. **Feature Tables** - Update all ✅/❌ markers based on current implementations
63
- 3. **New Features** - Add any new features found in the TypeScript SDK
64
- 4. **Removed Features** - Remove any deprecated features
65
-
66
- ### Categories to Compare
67
-
68
- 1. Options/Configuration
69
- 2. Message Types
70
- 3. Content Blocks
71
- 4. Control Protocol
72
- 5. Hooks
73
- 6. Permissions
74
- 7. MCP Support
75
- 8. Sessions
76
- 9. Subagents
77
- 10. Sandbox Settings
78
- 11. Error Handling
79
- 12. Client API
80
-
81
- ## Guidelines
82
-
83
- - **Be thorough** - Check every field and option in each SDK
84
- - **TypeScript is authoritative** - The TypeScript sdk.d.ts is the most complete reference
85
- - **Preserve format** - Keep the existing table structure and markdown formatting
86
- - **Update versions** - Always update the reference version info at the top
87
- - **Note changes** - If significant changes are found, mention them after updating
88
-
89
- ## Output
90
-
91
- After updating SPEC.md, provide a brief summary of:
92
- - SDK versions checked
93
- - Any new features added to the spec
94
- - Any features removed from the spec
95
- - Any notable gaps in the Ruby SDK