UNPKG

mcp-openapi-schema-explorer

Version:
33 lines (32 loc) 1.5 kB
import { OpenAPIV3 } from 'openapi-types'; import { RenderContext, RenderResultItem } from './types.js'; type ListItemType = 'componentType' | 'componentName' | 'pathMethod'; interface HintContext { itemType: ListItemType; firstItemExample?: string; parentComponentType?: string; parentPath?: string; } /** * Safely retrieves the summary from an Operation object. * Handles cases where the operation might be undefined or lack a summary. * * @param operation - The Operation object or undefined. * @returns The operation summary or operationId string, truncated if necessary, or null if neither is available. */ export declare function getOperationSummary(operation: OpenAPIV3.OperationObject | undefined): string | null; /** * Helper to generate a standard hint text for list views, using the centralized URI builders. * @param renderContext - The rendering context containing the base URI. * @param hintContext - Context about the type of items being listed and their parent context. * @returns The hint string. */ export declare function generateListHint(renderContext: RenderContext, hintContext: HintContext): string; /** * Helper to generate a standard error item for RenderResultItem arrays. * @param uriSuffix - The URI suffix for the error context. * @param message - The error message. * @returns A RenderResultItem array containing the error. */ export declare function createErrorResult(uriSuffix: string, message: string): RenderResultItem[]; export {};