用途:为使用 Omni Gateway Policy Development Kit(PDK)编写 Rust → WebAssembly 自定义策略的开发者,提供经过验证、可编译的功能模板。当请求形如“PDK 里怎么做某功能”“给个 PDK 模板”“PDK Rust 片段”或直接给出 PDK/Omni Gateway/自定义策略语境下的功能名时触发。
主要能力:技能在本地 templates/ 目录内置约 30 个模板,涵盖请求/响应处理(header_manipulation、body_manipulation、body_stream、request_data、control_flow)、身份与访问控制(authentication、jwt、jwt_generate、oauth2_token_introspection、ip_filter、contracts)、外部调用(http_call、grpc、dataweave、outbound)、校验与转换(json_validator、xml_validator)、限流与并发(rate_limiting、spike_control、cache、lock)、可观测性(logger、metadata、policy_violation、timer)、状态(data_storage、worker_variable)及其他(cors、stop_iteration、unit_testing)。
使用方式:按索引选中对应文件,用 Read 工具读取原文,不要凭记忆重写或转述,因为导入、类型签名和回调结构需保持精确;再按用户策略适配——重命名与已有 request_filter/response_filter/configure 冲突的函数,把 Config 引用改成用户 gcl.yaml 中真实的属性名(模板使用 exampleService、exampleDateweaveProperty 等占位名),读配置的功能需在 definition/gcl.yaml 中声明对应 properties 块,并按需删减用户未要求的请求侧或响应侧代码。多文件功能需完整交付每个文件并说明放置位置:dataweave/、http_call/ 的 lib.rs 与 gcl.yaml;stop_iteration/ 的 lib.rs 与 Cargo.toml.snippet(pdk 依赖需 >= 1.8.0 且带 features = ["enable_stop_iteration"]);grpc/ 的 lib.rs、gcl.yaml、build.rs、proto/example.proto 与 Cargo.toml.snippet(需 protobuf 3.5.0、protobuf-codegen 3.5.0);outbound/ 仅 gcl.yaml。改名 proto 文件时,磁盘路径、build.rs 中 .input("proto/<name>.proto") 与 lib.rs 中 use crate::<name>::{...} 三处须一致。改动 gcl.yaml 后建议执行 make build-asset-files 再 make build。
适用场景:需要某个 PDK 功能的可编译参考片段,以及了解多文件功能的工程放置方式。
限制:一次只返回一个功能模板;组合多个功能时需分别拉取后由用户自行合并,不自动编造组合片段。模板为上游 mulesoft-mcp-server 仓库的快照,属只读权威参考,不应修改。环境搭建、脚手架/构建/发布/升级、单元测试端到端流程分别属于其他技能。各功能的收费、平台与效果资料中暂未提供。