/**
 * Pure helpers for MCP meta-tool aggregation (Track A of mcp-meta-tool-aggregation design).
 *
 * One meta-tool per MCP server (`mcp_<server>`) collapses N×M per-op tools into a
 * single tool surface for the model. Helpers here are protocol-only — execution
 * dispatch and on-disk identifiers (`mcp__<server>__<op>`) are unchanged.
 */
import type { McpToolDef } from "./mcp-types.js";
/** Stable export of the meta-tool name prefix. */
export declare const MCP_META_PREFIX = "mcp_";
/**
 * Result of parsing a Bobbit MCP tool name. Pure structural parse — does not
 * check whether the server is connected or whether the operation exists.
 */
export interface ParsedMcpToolName {
    /** MCP server name (e.g. "gr", "playwright"). */
    server: string;
    /** Sub-namespace if any (e.g. "ai-adoption"). undefined ⇒ flat server. */
    sub?: string;
    /** Operation name (everything after the sub, or after the server if no sub). */
    op: string;
}
/**
 * Single source of truth for parsing canonical Bobbit MCP per-op tool names
 * of the form `mcp__<server>__<rest>`. Strips the `mcp__<server>__` prefix
 * and splits the remainder on the FIRST `__`:
 *
 *   - 0 separators → `{server, op}` (flat server)
 *   - ≥1 separator → `{server, sub: <left>, op: <right-literal-with-remaining-__>}`
 *
 * Returns `null` for any non-MCP name (no leading `mcp__`, missing op, etc.)
 * so callers can short-circuit cleanly.
 *
 * | Input                                  | server   | sub           | op              |
 * |----------------------------------------|----------|---------------|-----------------|
 * | mcp__gr__ai-adoption__list-articles    | gr       | ai-adoption   | list-articles   |
 * | mcp__gr__ai-adoption__create-article   | gr       | ai-adoption   | create-article  |
 * | mcp__gr__jira__get-queue               | gr       | jira          | get-queue       |
 * | mcp__playwright__click                 | playwright | (none)      | click           |
 * | mcp__foo__a__b__c                      | foo      | a             | b__c (literal)  |
 */
export declare function parseMcpToolName(bobbitName: string): ParsedMcpToolName | null;
/**
 * Sanitise a server (and optional sub-namespace) into a meta-tool name
 * matching Anthropic API rules (`[a-zA-Z0-9_-]+`, ≤64 chars total).
 *
 * Shapes:
 *   - `makeMetaToolName("playwright")`         → `"mcp_playwright"`
 *   - `makeMetaToolName("gr", "ai-adoption")`   → `"mcp_gr__ai-adoption"`
 *
 * 64-char cap preserves the server segment — when sub is provided and the
 * combined name would overflow, the sub-namespace is truncated first; if
 * even the bare `mcp_<server>` exceeds 64 chars we fall through to the
 * single-arg truncation behaviour.
 *
 * @throws if `serverName` is empty or whitespace-only, or if `sub` is
 *   provided but empty.
 */
export declare function makeMetaToolName(serverName: string, sub?: string): string;
/**
 * True if a tool def carries a usable JSON Schema:
 *   - `inputSchema.type === "object"`
 *   - `properties` is missing OR a plain object
 *   - non-empty string `name`
 *
 * Logs `[mcp]` warning on rejection so server operators can spot bad servers.
 */
export declare function isValidOperationSchema(tool: McpToolDef): boolean;
/**
 * Build the meta-tool input_schema. `operation` is constrained to an enum of
 * valid op names (preserving input order). `args` is an opaque object —
 * detailed schemas live in the per-server tool-docs file (fetched on demand
 * via `mcp_describe`).
 *
 * If no ops are valid, the enum becomes `["__unavailable__"]` so the model
 * can still see a stub but cannot fabricate a working call.
 */
export declare function buildMetaToolInputSchema(ops: McpToolDef[]): Record<string, unknown>;
/**
 * Build the meta-tool description: a single short line with the server name,
 * operation count, and a pointer at the auto-generated docs file. Op names
 * are NOT inlined — per-op detail lives in the off-wire docs file fetched
 * via `mcp_describe`. Hard-capped at 150 chars.
 */
export declare function buildMetaToolDescription(serverName: string, ops: McpToolDef[], docsRelPath: string): string;
//# sourceMappingURL=mcp-meta.d.ts.map