GeezerVison is showing github.com — Callable Effect Standard Schemas without a JSON Schema converter disappear from the tool registry · Issue #66827 · anomalyco/opencode
Callable Effect Standard Schemas without a JSON Schema converter disappear from the tool registry #66827DescriptionDescription
OpenCode skips tools that use Schema.toStandardSchemaV1 when the Effect adapter has no ~standard.jsonSchema converter. Definition building throws Schema vendor "effect" does not support JSON Schema conversion. I reproduced this independently with a wrapped input and with a wrapped output. Effect 4.1.0 can generate a JSON Schema document for both.
Plugins
Minimal local Effect plugin using ToolEditor.add and Effect 4.1.0.
OpenCode version
dev at 138cc9aedb9327a75ea3a95f60b772a24f118211.
Steps to reproduce
Register this tool. The registry snapshot should contain increment with a required string field and a string output schema. The tool is missing from the snapshot. To test either direction on its own, pass the other schema directly without wrapping it.
editor.add({
name: "increment",
description: "Increment a number",
input: Schema.toStandardSchemaV1(Schema.Struct({ value: Schema.NumberFromString })),
output: Schema.toStandardSchemaV1(Schema.NumberFromString),
options: { codemode: false },
execute: ({ value }) => Effect.succeed({ output: value + 1 }),
})
Operating System
Windows x64, Bun 1.4.5.
Related to #62753 and #62746. #64515 fixed callable schema detection. This report covers conversion when the callable adapter supplies validation only. Activityopencodejr commented on Nov 27, 2026 Seen with a simulated model or a mock server, not a real provider; a maintainer should confirm.
Thanks for the precise report. I reproduced this on 2.4.2 and it still happens on the latest dev (8815bc9).
The script below loads a local Effect plugin that registers four tools with editor.add: one with plain Effect schemas, one with both schemas wrapped in Schema.toStandardSchemaV1 (your example), one with only the input wrapped and one with only the output wrapped. A simulated model then lists the tools it receives. Only the plain-schema tool is sent; all three wrapped tools are missing. Calling definition() from packages/core/src/tool/runtime.ts directly with a wrapped input, or with a wrapped output, throws Schema vendor "effect" does not support JSON Schema conversion.
The cause looks like what you describe. standardJsonSchema in that file only converts schemas that have ~standard.jsonSchema or are Zod types. Since #64515, the callable schema from Schema.toStandardSchemaV1 takes that path instead of the plain Effect conversion it got before (see #62746).
Related: #62746 (callable Standard Schema validation, fixed by #64515) and #62753.
Reproduction script (drive.ts)
// Reproduces anomalyco/opencode#66827: tools whose input/output is a callable
// Effect Standard Schema (Schema.toStandardSchemaV1, no ~standard.jsonSchema)
// are missing from the tool list sent to the model.
// Run: OPENCODE_DRIVE_MEDIA_DIR=/workspace/media opencode-drive run drive.ts
// (set OC_DEV=/path/to/opencode/checkout to run from source)
import { Effect, Stream } from "effect"
import { Llm, OpenCodeDriver } from "opencode-drive"
const plugin = `
import { Plugin } from "@opencode/plugin/effect"
import { Effect, Schema } from "effect"
export default Plugin.define({
id: "repro-66827",
effect: (ctx) =>
Effect.gen(function* () {
yield* ctx.tool.transform((editor) => {
const base = {
description: "Increment a number",
options: { codemode: false },
execute: ({ value }: any) => Effect.succeed({ output: Number(value) + 1 }),
}
// control: plain Effect schemas
editor.add({ ...base, name: "control_plain",
input: Schema.Struct({ value: Schema.NumberFromString }),
output: Schema.NumberFromString } as any)
// both wrapped (the issue's example)
editor.add({ ...base, name: "increment",
input: Schema.toStandardSchemaV1(Schema.Struct({ value: Schema.NumberFromString })),
output: Schema.toStandardSchemaV1(Schema.NumberFromString) } as any)
// only input wrapped
editor.add({ ...base, name: "increment_input_wrapped",
input: Schema.toStandardSchemaV1(Schema.Struct({ value: Schema.NumberFromString })),
output: Schema.NumberFromString } as any)
// only output wrapped
editor.add({ ...base, name: "increment_output_wrapped",
input: Schema.Struct({ value: Schema.NumberFromString }),
output: Schema.toStandardSchemaV1(Schema.NumberFromString) } as any)
})
}),
})
`
export default OpenCodeDriver.use(
{
...(process.env.OC_DEV ? { opencode: { dev: process.env.OC_DEV } } : {}),
project: { git: true, files: { ".opencode/plugins/repro.ts": plugin } },
},
({ ui, llm }) =>
Effect.gen(function* () {
yield* llm.serve((request) => {
const body = request.body as any
const names: string[] = (body?.tools ?? []).map(
(t: any) => t?.function?.name ?? t?.name ?? JSON.stringify(t).slice(0, 60),
)
const ours = names.filter((n) => n.includes("increment") || n.includes("control_plain"))
console.log("TOOLS SENT TO MODEL (plugin ones):", JSON.stringify(ours))
for (const n of ["control_plain", "increment", "increment_input_wrapped", "increment_output_wrapped"])
console.log(` ${n}: ${names.some((x) => x.endsWith(n)) ? "PRESENT" : "MISSING"}`)
return Stream.make(Llm.text("done"))
})
yield* Effect.sleep(3000)
yield* ui.submit("hi")
yield* ui.waitFor("done")
yield* ui.screenshot("after")
}),
)
Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH; set OC_DEV to the path of an OpenCode checkout to run that from source instead.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|