mcp-swagger-parser
Version:
Enterprise-grade OpenAPI/Swagger specification parser for Model Context Protocol (MCP) projects
65 lines • 1.96 kB
TypeScript
/**
* Enhanced utility functions for OpenAPI parsing and transformation
*/
import type { OpenAPISpec, ReferenceObject } from '../types/index';
/**
* Check if an object is a reference object
*/
export declare function isReferenceObject(obj: any): obj is ReferenceObject;
/**
* Extract operation count from OpenAPI spec
*/
export declare function getOperationCount(spec: OpenAPISpec): number;
/**
* Extract path count from OpenAPI spec
*/
export declare function getPathCount(spec: OpenAPISpec): number;
/**
* Extract schema count from OpenAPI spec
*/
export declare function getSchemaCount(spec: OpenAPISpec): number;
/**
* Get all tags from OpenAPI spec
*/
export declare function getAllTags(spec: OpenAPISpec): string[];
/**
* Normalize OpenAPI version string
*/
export declare function normalizeVersion(version: string): string;
/**
* Check if OpenAPI version is supported
*/
export declare function isSupportedVersion(version: string): boolean;
/**
* Extract path parameters from OpenAPI path string
*/
export declare function extractPathParameters(path: string): string[];
/**
* Generate tool name from operation
*/
export declare function generateToolName(method: string, path: string, operationId?: string): string;
/**
* Get action verb from HTTP method
*/
export declare function getActionFromMethod(method: string): string;
/**
* Get resource name from path
*/
export declare function getResourceFromPath(path: string): string;
/**
* Validate URL format
*/
export declare function isValidUrl(url: string): boolean;
/**
* Sanitize string for use as identifier
*/
export declare function sanitizeIdentifier(str: string): string;
/**
* Format duration in human readable format
*/
export declare function formatDuration(milliseconds: number): string;
/**
* Parse content type to determine format
*/
export declare function parseContentType(contentType: string): 'json' | 'yaml' | 'unknown';
//# sourceMappingURL=index.d.ts.map