@ampcode/plugin 0.0.0-20261015001659-g73eff93 → 0.0.0-20261016001627-gab25fd2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +24 -1
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1981,9 +1981,26 @@ declare module '@ampcode/plugin' {
1981
1981
  }
1982
1982
 
1983
1983
  /**
1984
- * Context shared by all plugin event handlers.
1984
+ * Direct tool execution in the invoking thread.
1985
1985
  */
1986
+ export interface PluginTools {
1987
+ /**
1988
+ * Call a tool in the current thread without asking a model. Use a built-in or plugin tool
1989
+ * name, or an MCP `module.function` name from tool_search. Local MCP tools also accept
1990
+ * their `mcp__server__tool` names. Normal permissions and confirmations still apply.
1991
+ * Returns the tool's result (the full CallToolResult for MCP). Rejects on execution
1992
+ * failure, including MCP isError responses. Requires a connected thread.
1993
+ * Subagent tools and durable waits are not supported. Calls are not added to the
1994
+ * transcript and are never automatically retried after a lost connection.
1995
+ */
1996
+ call(name: string, input: Record<string, unknown>): Promise<unknown>
1997
+ }
1998
+
1999
+ /** Context shared by all plugin event handlers. */
1986
2000
  export interface PluginEventContextBase {
2001
+ /** Tools available in the current thread. */
2002
+ tools: PluginTools
2003
+
1987
2004
  /** Scoped logger for plugin output. Log messages are appended to the handler's trace span events. */
1988
2005
  logger: PluginLogger
1989
2006
 
@@ -2120,6 +2137,9 @@ declare module '@ampcode/plugin' {
2120
2137
  * Provides access to UI capabilities for executing command actions.
2121
2138
  */
2122
2139
  export interface PluginCommandContext {
2140
+ /** Tools available in the current thread. Calls reject if no thread is active. */
2141
+ tools: PluginTools
2142
+
2123
2143
  /** Platform UI capabilities */
2124
2144
  ui: PluginUI
2125
2145
 
@@ -2145,6 +2165,9 @@ declare module '@ampcode/plugin' {
2145
2165
  * Context passed to tool execute handlers.
2146
2166
  */
2147
2167
  export interface PluginToolContext {
2168
+ /** Tools available in the current thread. */
2169
+ tools: PluginTools
2170
+
2148
2171
  /** UI capabilities provided to plugins */
2149
2172
  ui: PluginUI
2150
2173
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampcode/plugin",
3
- "version": "0.0.0-20261015001659-g73eff93",
3
+ "version": "0.0.0-20261016001627-gab25fd2",
4
4
  "description": "Amp Plugin API",
5
5
  "homepage": "https://ampcode.com/docs/plugin-api",
6
6
  "author": {