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; declare const dbResultToMcpTool: (dbResult: ToolSelect, dbClient: AgentsManageDatabaseClient, credentialStoreRegistry?: CredentialStoreRegistry, relationshipId?: string, userId?: string) => Promise>; declare const getToolById: (db: AgentsManageDatabaseClient) => (params: { scopes: ProjectScopeConfig; toolId: string; }) => Promise<{ id: string; name: string; createdAt: string; updatedAt: string; description: string | null; headers: Record | null; projectId: string; tenantId: string; 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; 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 | 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; createdAt: string; updatedAt: string; description: string | null; headers: Record | null; projectId: string; tenantId: string; 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; }) => Promise<{ createdAt: string; updatedAt: string; config: { type: "mcp"; mcp: ToolMcpConfig; }; credentialReferenceId: string | null; credentialScope: string; headers: Record | 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; declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: { scopes: AgentScopeConfig; subAgentId: string; toolId: string; selectedTools?: string[] | null; headers?: Record | null; toolPolicies?: Record | null; }) => Promise<{ id: string; createdAt: string; updatedAt: string; headers: Record | null; projectId: string; tenantId: string; agentId: string; subAgentId: string; toolId: string; toolPolicies: Record | null; selectedTools: string[] | null; }>; declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: { scopes: AgentScopeConfig; subAgentId: string; toolId: string; }) => Promise<{ id: string; createdAt: string; updatedAt: string; headers: Record | null; projectId: string; tenantId: string; agentId: string; subAgentId: string; toolId: string; toolPolicies: Record | null; 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 | null; toolPolicies?: Record | null; relationId?: string; }) => Promise<{ id: string; createdAt: string; updatedAt: string; headers: Record | null; projectId: string; tenantId: string; agentId: string; subAgentId: string; toolId: string; toolPolicies: Record | null; 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; createdAt: string; updatedAt: string; description: string | null; headers: Record | null; projectId: string; tenantId: string; 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 };