/** * Tool handler implementations for the Green Design System. * * This module contains the core business logic for each tool operation: * searching components, fetching documentation, listing guides, and * retrieving instructions. These handlers are shared between the MCP * server (tools.ts) and the context CLI (context-cli/index.ts). * * Each handler: * 1. Validates its input via the validation module * 2. Loads pre-generated MCP data from disk * 3. Applies business logic (search, filtering, assembly) * 4. Returns a uniform `{ content: [{ type: 'text', text: string }] }` response * * @module handlers */ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'; /** * Standard response shape returned by all handlers. * Mirrors the MCP content response format so both the MCP server * and the CLI can consume results uniformly. */ export type HandlerResponse = CallToolResult; /** * Handle search_components — search for components and icons by name, * description, or functionality. * * @param input - Raw input object (validated internally) * @returns Search results as JSON text * @throws {ValidationError} If input fails validation */ export declare function handleSearchComponents(input: unknown): Promise; /** * Handle get_component_docs — retrieve full documentation for a specific * component, including framework-specific imports, API reference, design * guidelines, and agent usage instructions. * * @param input - Raw input object (validated internally) * @returns Assembled markdown documentation * @throws {ValidationError} If input fails validation * @throws {NotFoundError} If the component cannot be found */ export declare function handleGetComponentDocs(input: unknown): Promise; /** * Handle list_guides — list available setup guides and conceptual * documentation, optionally filtered by category and framework. * * @param input - Raw input object (validated internally) * @returns JSON list of guides with metadata and resource URIs * @throws {ValidationError} If input fails validation * @throws {NotFoundError} If the global index cannot be loaded */ export declare function handleListGuides(input: unknown): Promise; /** * Handle get_guide — retrieve the full content of a specific guide. * * @param input - Raw input object (validated internally) * @returns Guide content as markdown * @throws {ValidationError} If input fails validation * @throws {NotFoundError} If the guide cannot be found */ export declare function handleGetGuide(input: unknown): Promise; /** * Handle get_instructions — retrieve the base instructions document * containing critical rules, typography guidelines, layout system * requirements, and general best practices. * * @returns Instructions content as markdown * @throws {NotFoundError} If instructions are not available */ export declare function handleGetInstructions(): Promise; /** * Handle URI resolution — read the raw content of a green:// resource URI. * * Supports all URI types: * - green://components/{name}/{docType} (e.g. green://components/button/api) * - green://icons/{name}/{docType} (e.g. green://icons/arrow/api) * - green://guides/{name} (e.g. green://guides/angular) * - green://concepts/{name} (e.g. green://concepts/tokens) * - green://instructions (the root instructions document) * * @param uri - A green:// resource URI string * @returns Raw markdown content of the resource * @throws {NotFoundError} If the URI is invalid or the resource doesn't exist */ export declare function handleResolveUri(uri: string): Promise; /** * Handle get_tokens — retrieve design token information, optionally * filtered by category and color subcategory. * * @param input - Raw input object (validated internally) * @returns Token data as JSON * @throws {ValidationError} If input fails validation * @throws {NotFoundError} If tokens data cannot be loaded */ export declare function handleGetTokens(input: unknown): Promise;