import { AgentScopeConfig, ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
import { PaginationConfig, ToolMcpConfig, ToolServerCapabilities } from "../../types/utility.js";
import "../../types/index.js";
import { CredentialStoreRegistry } from "../../credential-stores/CredentialStoreRegistry.js";
import "../../credential-stores/index.js";
import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
import { WithTimestamps } from "../../validation/extend-schemas.js";
import "../../index.js";
import { McpTool, ToolInsert, ToolSelect, ToolUpdate } from "../../types/entities.js";

//#region src/data-access/manage/tools.d.ts
/**
 * Convert DB result to McpTool skeleton WITHOUT MCP discovery.
 * This is a fast path that returns status='unknown' and empty availableTools.
 * Use this for list views where you want instant page load.
 */
declare const dbResultToMcpToolSkeleton: (dbResult: ToolSelect, relationshipId?: string) => WithTimestamps<McpTool>;
declare const dbResultToMcpTool: (dbResult: ToolSelect, dbClient: AgentsManageDatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry, relationshipId?: string, userId?: string) => Promise<WithTimestamps<McpTool>>;
declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  toolId: string;
}) => Promise<{
  id: string;
  name: string;
  description: string | null;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  headers: Record<string, string> | null;
  config: {
    type: "mcp";
    mcp: ToolMcpConfig;
  };
  credentialReferenceId: string | null;
  credentialScope: string;
  imageUrl: string | null;
  capabilities: ToolServerCapabilities | null;
  lastError: string | null;
  isWorkApp: boolean;
} | null>;
declare const getMcpToolById: (db: AgentsManageDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  toolId: string;
  relationshipId?: string;
  credentialStoreRegistry?: CredentialStoreRegistry;
  userId?: string;
}) => Promise<McpTool | null>;
declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  pagination?: PaginationConfig;
}) => Promise<{
  data: {
    createdAt: string;
    updatedAt: string;
    config: {
      type: "mcp";
      mcp: ToolMcpConfig;
    };
    credentialReferenceId: string | null;
    credentialScope: string;
    headers: Record<string, string> | null;
    imageUrl: string | null;
    capabilities: ToolServerCapabilities | null;
    lastError: string | null;
    isWorkApp: boolean;
    name: string;
    description: string | null;
    projectId: string;
    tenantId: string;
    id: string;
  }[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    pages: number;
  };
}>;
declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
  id: string;
  name: string;
  description: string | null;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  headers: Record<string, string> | null;
  config: {
    type: "mcp";
    mcp: ToolMcpConfig;
  };
  credentialReferenceId: string | null;
  credentialScope: string;
  imageUrl: string | null;
  capabilities: ToolServerCapabilities | null;
  lastError: string | null;
  isWorkApp: boolean;
}>;
declare const updateTool: (db: AgentsManageDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  toolId: string;
  data: WithTimestamps<ToolUpdate>;
}) => Promise<{
  createdAt: string;
  updatedAt: string;
  config: {
    type: "mcp";
    mcp: ToolMcpConfig;
  };
  credentialReferenceId: string | null;
  credentialScope: string;
  headers: Record<string, string> | null;
  imageUrl: string | null;
  capabilities: ToolServerCapabilities | null;
  lastError: string | null;
  isWorkApp: boolean;
  name: string;
  description: string | null;
  projectId: string;
  tenantId: string;
  id: string;
}>;
declare const deleteTool: (db: AgentsManageDatabaseClient) => (params: {
  scopes: ProjectScopeConfig;
  toolId: string;
}) => Promise<boolean>;
declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  subAgentId: string;
  toolId: string;
  selectedTools?: string[] | null;
  headers?: Record<string, string> | null;
  toolPolicies?: Record<string, {
    needsApproval?: boolean;
  }> | null;
}) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  toolId: string;
  headers: Record<string, string> | null;
  toolPolicies: Record<string, {
    needsApproval?: boolean;
  }> | null;
  subAgentId: string;
  selectedTools: string[] | null;
}>;
declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  subAgentId: string;
  toolId: string;
}) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  toolId: string;
  headers: Record<string, string> | null;
  toolPolicies: Record<string, {
    needsApproval?: boolean;
  }> | null;
  subAgentId: string;
  selectedTools: string[] | null;
}>;
/**
 * Upsert agent-tool relation (create if it doesn't exist, update if it does)
 */
declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
  scopes: AgentScopeConfig;
  subAgentId: string;
  toolId: string;
  selectedTools?: string[] | null;
  headers?: Record<string, string> | null;
  toolPolicies?: Record<string, {
    needsApproval?: boolean;
  }> | null;
  relationId?: string;
}) => Promise<{
  id: string;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  agentId: string;
  toolId: string;
  headers: Record<string, string> | null;
  toolPolicies: Record<string, {
    needsApproval?: boolean;
  }> | null;
  subAgentId: string;
  selectedTools: string[] | null;
}>;
/**
 * Upsert a tool (create if it doesn't exist, update if it does)
 */
declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
  data: ToolInsert;
}) => Promise<{
  id: string;
  name: string;
  description: string | null;
  createdAt: string;
  updatedAt: string;
  tenantId: string;
  projectId: string;
  headers: Record<string, string> | null;
  config: {
    type: "mcp";
    mcp: ToolMcpConfig;
  };
  credentialReferenceId: string | null;
  credentialScope: string;
  imageUrl: string | null;
  capabilities: ToolServerCapabilities | null;
  lastError: string | null;
  isWorkApp: boolean;
}>;
//#endregion
export { addToolToAgent, createTool, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteTool, getMcpToolById, getToolById, listTools, removeToolFromAgent, updateTool, upsertSubAgentToolRelation, upsertTool };