import "../../permissions-BBgPgD70.js";
import { AgentToolResponse } from "../../utils-BV58GdRy.js";
import { ServerContext } from "../../types-DjbiyvLT.js";
import { ToolConfig } from "../../types-Bu5blaB3.js";
import { z } from "zod";
import * as ai266 from "ai";

//#region src/tools/use-sentry/tool-wrapper.d.ts

/**
 * Options for wrapping a tool
 */
interface WrapToolOptions {
  context: ServerContext;
}
/**
 * Wraps any MCP tool to work with the embedded agent pattern.
 *
 * This function:
 * 1. Takes a tool definition with its handler
 * 2. Creates an agentTool-wrapped version
 * 3. Pre-binds ServerContext so the agent doesn't need it
 * 4. Applies session constraints automatically
 * 5. Handles errors via agentTool's error handling
 *
 * @param tool - The MCP tool to wrap (from defineTool)
 * @param options - Context and configuration for the tool
 * @returns An agentTool-wrapped version ready for use by the embedded agent
 *
 * @example
 * ```typescript
 * const whoami = wrapToolForAgent(whoamiTool, { context });
 * const findOrgs = wrapToolForAgent(findOrganizationsTool, { context });
 * ```
 */
declare function wrapToolForAgent<TSchema extends Record<string, z.ZodType>>(tool: ToolConfig<TSchema>, options: WrapToolOptions): ai266.Tool<z.ZodType<z.objectUtil.addQuestionMarks<z.baseObjectOutputType<TSchema>, any> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<TSchema>, any>[k] } : never, z.ZodTypeDef, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<TSchema>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<TSchema>, any>[k] } : never>, AgentToolResponse<string | ({
  [x: string]: unknown;
  type: "text";
  text: string;
  _meta?: {
    [x: string]: unknown;
  } | undefined;
} | {
  [x: string]: unknown;
  type: "image";
  data: string;
  mimeType: string;
  _meta?: {
    [x: string]: unknown;
  } | undefined;
} | {
  [x: string]: unknown;
  type: "resource";
  resource: {
    [x: string]: unknown;
    uri: string;
    text: string;
    _meta?: {
      [x: string]: unknown;
    } | undefined;
    mimeType?: string | undefined;
  } | {
    [x: string]: unknown;
    uri: string;
    blob: string;
    _meta?: {
      [x: string]: unknown;
    } | undefined;
    mimeType?: string | undefined;
  };
  _meta?: {
    [x: string]: unknown;
  } | undefined;
})[]>> & {
  execute: (args: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<TSchema>, any> extends infer T_2 ? { [k in keyof T_2]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<TSchema>, any>[k] } : never, options: ai266.ToolExecutionOptions) => PromiseLike<AgentToolResponse<string | ({
    [x: string]: unknown;
    type: "text";
    text: string;
    _meta?: {
      [x: string]: unknown;
    } | undefined;
  } | {
    [x: string]: unknown;
    type: "image";
    data: string;
    mimeType: string;
    _meta?: {
      [x: string]: unknown;
    } | undefined;
  } | {
    [x: string]: unknown;
    type: "resource";
    resource: {
      [x: string]: unknown;
      uri: string;
      text: string;
      _meta?: {
        [x: string]: unknown;
      } | undefined;
      mimeType?: string | undefined;
    } | {
      [x: string]: unknown;
      uri: string;
      blob: string;
      _meta?: {
        [x: string]: unknown;
      } | undefined;
      mimeType?: string | undefined;
    };
    _meta?: {
      [x: string]: unknown;
    } | undefined;
  })[]>>;
};
//# sourceMappingURL=tool-wrapper.d.ts.map
//#endregion
export { WrapToolOptions, wrapToolForAgent };
//# sourceMappingURL=tool-wrapper.d.ts.map