import type { McpToolDefinition, McpToolContext, McpToolCategory, MutationAction, QueryResult, ToolError, ToolMeta } from '#blokkli/agent/app/types'; import type { BlokkliAdapter } from '#blokkli/editor/adapter'; import type { BlokkliApp } from '#blokkli/editor/types/app'; import type { EditMode } from '#blokkli/editor/types/state'; /** * Narrow an `unknown` to a plain record. One cast at the boundary so call * sites can read `obj.foo` without scattering casts everywhere. */ export declare function asRecord(value: unknown): Record | null; /** * Pull component side-channel meta (`_details`, `_usage`, `_skipLlmResponse`) * off an emitted tool result so the LLM-facing payload can be sent without * them. */ export declare function splitMeta(raw: unknown): { payload: unknown; meta: ToolMeta; }; /** * Create a map of tool name to tool definition for quick lookup. */ export declare function createToolMap(tools: McpToolDefinition[]): Record; /** * Get tool names for the server. * * Applies three filters in order: * 1. `tool.modes` must include the current edit mode. * 2. `tool.requiredAdapterMethods` (if any) must all exist on the adapter. * 3. `tool.isAvailable(app)` (if defined) must return (or resolve to) true. */ export declare function getToolInfoForServer(tools: McpToolDefinition[], editMode: EditMode, app: BlokkliApp, adapter?: BlokkliAdapter): Promise; /** * Execute a tool by name with the given context and parameters. * Validates parameters with Zod before executing. */ export declare function executeTool(toolMap: Record, name: string, context: McpToolContext, params: Record): Promise; /** * Get the category of a tool by name. */ export declare function getToolCategory(toolMap: Record, name: string): McpToolCategory; /** * Get the tool definition by name. */ export declare function getToolDefinition(toolMap: Record, name: string): McpToolDefinition; /** * Check if a result is a MutationAction. */ export declare function isMutationAction(result: unknown): result is MutationAction; /** * Check if a result is a QueryResult. */ export declare function isQueryResult(result: unknown): result is QueryResult; /** * Check if a result is a ToolError. */ export declare function isToolError(result: unknown): result is ToolError;