Skip to content

v0.5.0

Choose a tag to compare

@yazelin yazelin released this 25 Feb 07:03
· 2 commits to main since this release

What's New

on_tool_input_transform callback

New ClaudeClient callback for framework-level tool input transformation. Called after permission is granted, before tool execution.

Use case: Inject parameters (e.g., user identity) into MCP tool calls at the framework level, independent of LLM behavior.

client = ClaudeClient(cwd=".")

@client.on_tool_input_transform
async def inject_user(tool_name: str, tool_input: dict) -> dict | None:
    if tool_name.startswith("mcp__my-server__"):
        return {**tool_input, "user_id": current_user_id}
    return None  # keep original

Key properties:

  • Leverages claude_agent_sdk's native PermissionResultAllow(updated_input=...) support
  • Framework-controlled: LLM cannot manipulate injected values
  • Backward compatible: no changes to existing on_permission callback
  • Does not affect AcpClient or external ACP client connections

Full Changelog: v0.4.4...v0.5.0