/** * Skill discovery and metadata parsing module. * * Discovers Agent Skills from a directory, parses YAML frontmatter, * and generates server instructions XML. */ import type { Annotations } from "@modelcontextprotocol/sdk/types.js"; /** * Source information for a skill. * Indicates whether the skill comes from a local directory or GitHub repository. */ export interface SkillSource { type: "local" | "github" | "bundled"; displayName: string; prefix: string; owner?: string; repo?: string; } /** * Default source for skills discovered without explicit source info. */ export declare const DEFAULT_SKILL_SOURCE: SkillSource; /** * Source for skills bundled with the server package. */ export declare const BUNDLED_SKILL_SOURCE: SkillSource; /** * Metadata extracted from a skill's SKILL.md frontmatter. */ export interface SkillMetadata { name: string; baseName: string; description: string; path: string; disableModelInvocation?: boolean; userInvocable?: boolean; effectiveAssistantInvocable: boolean; effectiveUserInvocable: boolean; isAssistantOverridden: boolean; isUserOverridden: boolean; source: SkillSource; } /** * Sanitize a prefix string for use in qualified skill names. * Replaces spaces with hyphens and strips special characters. */ export declare function sanitizePrefix(raw: string): string; /** * Compute the SEP-2640 for a skill. * * Bundled (empty prefix) → baseName * Other → "/" * * The final segment always equals the frontmatter `name`, per SEP. */ export declare function getSkillPath(skill: SkillMetadata): string; /** * Build a full skill resource URI for a file relative to the skill root. * Per-segment encoding preserves slashes between path segments. */ export declare function buildSkillResourceUri(skill: SkillMetadata, fileRelPath: string): string; /** * Parse a skill:// URI into a (skill, fileRelPath) pair. * * Walks skillMap to disambiguate from , since the URI * itself does not encode where the skill segment ends. Longest-path-first * matching handles overlapping prefixes (e.g., foo/bar vs foo/bar/baz). * * Returns null if the URI is not a skill:// URI or no skill matches. */ export declare function parseSkillResourceUri(uri: string, skillMap: Map): { skill: SkillMetadata; fileRelPath: string; } | null; /** * Build the SEP-2640 discovery index document. * * All skills are emitted as type "skill-md" with a URL pointing to their * SKILL.md resource. Archive and resource-template entry types are out of * scope for this server. */ export declare function buildSkillIndex(skillMap: Map): { $schema: string; skills: Array<{ name: string; type: "skill-md"; description: string; url: string; }>; }; /** * Discover all skills in a directory. * Scans for subdirectories containing SKILL.md files. * * @param skillsDir - The directory to scan for skills * @param source - Optional source info to attach to discovered skills */ export declare function discoverSkills(skillsDir: string, source?: SkillSource): SkillMetadata[]; /** * Generate the server instructions with available skills. * Includes a brief preamble about skill usage following the Agent Skills spec. */ export declare function generateInstructions(skills: SkillMetadata[]): string; /** * Load the full content of a skill's SKILL.md file. */ export declare function loadSkillContent(skillPath: string): string; /** * Create a map from skill name to skill metadata for fast lookup. * Uses first-wins behavior: if duplicate names exist, the first occurrence is kept. */ export declare function createSkillMap(skills: SkillMetadata[]): Map; /** * Invocation override settings per skill (imported type reference). */ interface SkillInvocationOverrides { assistant?: boolean; user?: boolean; } /** * Apply invocation overrides from config to compute effective values. * Returns a new array with updated effective* fields. */ export declare function applyInvocationOverrides(skills: SkillMetadata[], overrides: Record): SkillMetadata[]; /** * Filter skills that can be invoked by the model (appear in tool description). * Uses effective value which considers config overrides. */ export declare function getModelInvocableSkills(skills: SkillMetadata[]): SkillMetadata[]; /** * Filter skills that can be invoked by the user (appear in prompts menu). * Uses effective value which considers config overrides. */ export declare function getUserInvocableSkills(skills: SkillMetadata[]): SkillMetadata[]; /** * Compute MCP resource annotations and file size for a skill. * Derives audience from effective invocation flags and sets default priority. * * @param skill - The skill metadata * @param priority - Priority hint (0.0 = least important, 1.0 = most important, default 0.5) * @returns Object with annotations and optional size (in bytes) for use on MCP resources */ export declare function getResourceAnnotations(skill: SkillMetadata, priority?: number): { annotations: Annotations; size?: number; }; export declare const SKILL_COUNT_WARNING_THRESHOLD = 50; export declare function warnLargeSkillCount(skillCount: number): void; export {};