Expand description
Skill generation for MCP progressive loading.
This crate provides functionality to generate Claude Code skill files (SKILL.md) from generated progressive loading TypeScript files.
§Architecture
The skill generation flow:
parser- Reads the_meta.jsonsidecar emitted by codegencontext- Builds structured context from parsed toolstemplate- Renders Handlebars template with context
§Examples
use mcp_execution_skill::{scan_tools_directory, build_skill_context, ScanError};
use std::path::Path;
let result = scan_tools_directory(Path::new("~/.claude/servers/github")).await?;
let context = build_skill_context("github", &result.tools, None);Re-exports§
pub use types::GenerateSkillParams;pub use types::GenerateSkillResult;pub use types::MAX_SERVER_ID_LENGTH;pub use types::SaveSkillParams;pub use types::SaveSkillResult;pub use types::SkillCategory;pub use types::SkillMetadata;pub use types::SkillServerIdError;pub use types::SkillTool;pub use types::ToolExample;pub use types::validate_server_id;
Modules§
- types
- Type definitions for skill generation.
Structs§
- Parsed
Parameter - A parsed parameter from a tool’s metadata.
- Parsed
Tool File - Parsed metadata from a server’s generated tool set.
- Scan
Result - Result of
scan_tools_directory: the parsed tools plus any non-fatal drift warnings.
Enums§
- Output
Path Error - Errors from resolving and confining a skill output path to its base directory.
- Scan
Error - Errors that can occur while scanning a server directory for its
_meta.jsonsidecar. - Skill
Metadata Error - Errors that can occur while extracting
SkillMetadatafrom aSKILL.md’s YAML frontmatter. - Template
Error - Errors that can occur during template rendering.
Constants§
- MAX_
FILE_ SIZE - Maximum sidecar file size to read in bytes (1MB).
- MAX_
FRONTMATTER_ SIZE - Maximum size of a
SKILL.md’s extracted YAML frontmatter block, in bytes. - MAX_
TOOL_ FILES - Maximum number of tools accepted from a single sidecar (denial-of-service protection).
Functions§
- build_
skill_ context - Build skill generation context from parsed tools.
- extract_
skill_ metadata - Extract skill metadata from SKILL.md content.
- render_
generation_ prompt - Render the skill generation prompt.
- render_
skill_ md - Render SKILL.md content directly from skill context.
- resolve_
skill_ output_ path - Resolves a
save_skilloutput path, confining it tobase_dir/server_id. - scan_
tools_ directory - Scan a server directory and read its
_meta.jsonsidecar.