We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Plugin Transforms

Transforms let plugins change the definitions OpenCode uses for tools, agents, models, and other features. For example, a plugin can adjust a tool's description or choose a default agent.

This is useful when you're packaging a customized OpenCode experience for a team. The plugin can inspect existing definitions and apply changes in code.

Updating a Tool

Suppose you're working on a project that includes generated files. This plugin adds a reminder to the read tool's description:

import { Plugin } from "@opencode/plugin";

export default Plugin.define({
  id: "bootdev.generated-files",
  setup: async (ctx) => {
    await ctx.tool.transform((tools) => {
      tools.update("read", (tool) => {
        tool.description +=
          "\nFor generated files, find the source template before proposing edits.";
      });
    });
  },
});

ctx.tool.transform() lets the plugin inspect and modify OpenCode's tool definitions. tools.update("read", ...) then finds the read tool and makes the specified changes.

Assignment

  1. Use this tool to run individual .slop examples when checking language behavior. Use the test suite for regression testing.

Tell OpenCode to run and submit the CLI tests from the project root.