effect-ai-tool

Define type-safe AI tools and toolkits using Effect AI's Tool and Toolkit APIs.

3|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-ai-tool-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-ai-tool
Source: https://github.com/mpsuesser/opencode-effect-enforcer/tree/main/skills/effect-ai-tool
Command: npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-ai-tool-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building LLM integrations with tool calling requires careful handling of parameter validation, typed errors, and handler dependencies. This Skill provides guidance for defining tools with Effect AI's Tool and Toolkit APIs so agents get schema-validated parameters, typed success/failure results, and composable toolkits without ad-hoc glue code. ## Core Features & Use Cases - User-Defined Tools: Create tools with Tool.make using Schema.Struct parameters, typed success/failure schemas, failureMode control, and declared service dependencies. - Toolkit Composition: Combine tools with Toolkit.make, implement handlers via toLayer or toHandlers, and execute calls through toolkit.handle with streaming preliminary and final results. - Provider-Defined and Dynamic Tools: Integrate provider-native capabilities like OpenAI WebSearch and FileSearch via Tool.providerDefined and OpenAiTool, or runtime-discovered tools via Tool.dynamic. - Use Case: When building a coding agent that needs file-read and search capabilities, define each tool with validated parameters, compose them into a toolkit, provide handler layers with service dependencies, and let the LLM invoke them with typed results. ## Quick Start Ask the agent to define an Effect AI tool with Tool.make that has validated parameters and a typed handler, then compose it into a toolkit with Toolkit.make.

Frequently Asked Questions about effect-ai-tool

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define a tool with Effect AI Tool.make?

Call Tool.make with a name string and a config object containing description, parameters as Schema.Struct, success and failure schemas, and optional failureMode. The tool name is the first argument, and parameters must be an Effect Schema.Top, not raw field objects.

How do I implement tool handlers in Effect AI?

Use toolkit.toLayer with an object mapping tool names to handler functions that return Effects. Handlers receive decoded parameters and a context with toolCallId and preliminary emitters, and the result is a Layer you provide to your program.

What is the difference between Tool.make, Tool.dynamic, and Tool.providerDefined?

Tool.make defines user tools with typed schemas. Tool.dynamic handles runtime-discovered tools from MCP or config, accepting either Effect schemas or raw JSON Schema. Tool.providerDefined models provider-native capabilities like OpenAI WebSearch or Anthropic bash.

Does Effect AI support tool approval flows?

Yes, Tool.make and Tool.dynamic support needsApproval, either as a boolean or a dynamic function receiving decoded parameters and context. When approval is required, the model emits a tool-approval-request and the caller responds with a toolApprovalResponsePart.

Why does toolkit.handle reject my decoded parameters?

toolkit.handle accepts Tool.ParametersEncoded, the encoded representation, and performs schema decoding itself. Passing already-decoded values is a type error for transforming schemas like NumberFromString; pass the encoded form and let handle decode it.

When should I use Toolkit.merge versus Toolkit.make?

In Effect v4, prefer Toolkit.make with all tools passed to the constructor rather than merging separate toolkits. Toolkit.merge still exists for combining collections, with later toolkits overriding earlier ones on name collision.