GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — The new custom tool ToolContext doesn't expose project, directory, and worktree as the docs example · Issue #2683 · anomalyco/opencode

The new custom tool ToolContext doesn't expose project, directory, and worktree as the docs example #2683

New issue
Copy link
New issue
Copy link
Closed
#2691
Closed
The new custom tool ToolContext doesn't expose project, directory, and worktree as the docs example#2683
#2691
Copy link
Assignees
rekram1-node

Description

@armedi
armedi
opened on Sep 19, 2025
Issue body actions

The custom tool docs page gives this example

import { tool } from "@opencode-ai/plugin"

export default tool({
  description: "Get project information",
  args: {},
  async execute(args, context) {
    // Access context information
    const { project, directory, worktree } = context
    return `Project: ${project.name}, Directory: ${directory}`
  },
})

where as in the source code at packages/plugin/src/tool.ts the context is only

export type ToolContext = {
  sessionID: string
  messageID: string
  agent: string
  abort: AbortSignal
}

I am writing a tool that need the information of the directory where opencode is running. How can I get this info?

UPDATE:

I figured I can just use process.cwd()

Activity

  1. rekram1-node
    self-assigned this
    on Sep 19, 2025
  2. rekram1-node
    closed this as completedin #2691on Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.