Answer: Use Rpc.define with Effect Schema to define the RPC, specifying methods with input/output/errors and adding events to the top-level events map. Event data must be an object. Status: Confirmed Entry: tool/opencode/integrations/define-rpc-methods-events Revision: 1 Digest: sha256:2a9ad64e44ae24d8 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:55:46Z Last changed: 2026-11-13T03:55:46Z Last verified: 2026-11-20T13:44:33Z Next check: 2026-11-21T13:44:33Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of definition function | Rpc.define | [1] | 2026-11-20 RPC id | acme | [1] | 2026-11-20 method input | Schema .Struct ({ query : Schema .String }) | [1] | 2026-11-20 method output | Schema .Struct ({ text : Schema .String }) | [1] | 2026-11-20 error key | not_found | [1] | 2026-11-20 event name | updated | [1] | 2026-11-20 Sources: [1] opencode. "Effect plugin RPC | OpenCode". https://opencode.ai/docs/build/plugins/effect/rpc/ Role: primary. Accessed: 2026-11-20T13:44:33Z Quote: "Define Use Rpc.define with Effect Schema to define the RPC." (Supports: definition function) Quote: "id : "acme"" (Supports: RPC id) Quote: "input : Schema .Struct ({ query : Schema .String })" (Supports: method input) Quote: "output : Schema .Struct ({ text : Schema .String })" (Supports: method output) Quote: "not_found : Schema .Struct ({ query : Schema .String })" (Supports: error key) Quote: "events : { updated : { schema : Schema .Struct ({ itemID : Schema .String , text : Schema .String }) , } , }" (Supports: event name) Snapshot SHA-256: 0577808d0e0cd3b820a826d4693b1850e6dded5f4a76ba0d7a1cb585fc71dd7c (captured 2026-11-18T13:38:10Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-18T13:38:10Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:44:33Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:44:33Z Last attempt: 2026-11-20T13:44:33Z Notes and limitations: Extracted automatically from a single official source (section "Define"). Related: https://latestn.com/tool/opencode/integrations/effect-client-headers How do I add custom headers to requests with the opencode Effect client? https://latestn.com/tool/opencode/integrations/effect-plugin-rpc How do I call opencode plugin RPC methods from the Effect client? https://latestn.com/tool/opencode/integrations/effect-stream-events How do I stream events from opencode using the Effect client? https://latestn.com/tool/opencode/integrations/customize-effect-layers How do I customize or provide layers in the opencode Effect SDK? https://latestn.com/tool/opencode/integrations/define-gui-plugin How do I define a GUI plugin for opencode? https://latestn.com/tool/opencode/integrations/define-rpc-methods-errors-events How do I define RPC methods, errors, and events in an opencode plugin? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:55:46Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/opencode/integrations/define-rpc-methods-events/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/opencode/integrations/define-rpc-methods-events POST: https://latestn.com/dispute/tool/opencode/integrations/define-rpc-methods-events with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/opencode/integrations/define-rpc-methods-events?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I define an RPC with methods and events in an opencode Effect plugin? Revision 1, last verified 2026-11-20T13:44:33Z. https://latestn.com/tool/opencode/integrations/define-rpc-methods-events (accessed 2026-11-21T09:53:04Z). @misc{LatestN_tool_opencode_integrations_define_rpc_methods_events_r1, title = {How do I define an RPC with methods and events in an opencode Effect plugin?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/opencode/integrations/define-rpc-methods-events}}, note = {Revision 1; digest sha256:2a9ad64e44ae24d8; last verified 2026-11-20T13:44:33Z; accessed 2026-11-21T09:53:04Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/opencode/integrations/define-rpc-methods-events