| 工具 | 作用 |
|---|---|
optimize_prompt | Optimize a prompt with deterministic, verified transforms (duplicates, filler, optional sections). Every candidate is checked to preserve all sentences, requirements, code, and variables; the original is kept if nothing is better. Returns the selected prompt, token savings, quality score, and what changed. |
optimize_prompt_pipeline | Run the optimization pipeline and return per-stage results plus token and estimated cost metrics, in the result shape used by the PromptFlow VS Code extension. |
compress_prompt | Remove exact duplicate sentences and extra whitespace without rewriting any wording. |
validate_prompt | Check a prompt for missing objective or output format, ambiguity, conflicting instructions, duplicates, prompt-injection patterns, secrets, and undelimited variables. isValid is false only when a critical issue exists. |
estimate_tokens | Count tokens and estimate input cost for a model. "exact" is true only for OpenAI models with a loaded tokenizer; other providers are approximate. Costs are estimates from a reference price table. |
analyze_prompt | Detect intent, task type, technical domain, requested output, requirements, and entities (languages, frameworks, file paths, identifiers). |
extract_entities | Extract languages, frameworks, libraries, cloud platforms, services, technologies, file paths, identifiers, URLs, and commands. |
summarize_context | Extractive summary: the first N unique, non-empty sentences of a context block, in order. Does not rank or rewrite. |
score_prompt | Score prompt quality 0-100: 100 minus a penalty per issue (critical 30, warning 10, info 3; capped at 50 with any critical issue), with per-dimension scores and suggestions. |
evaluate_prompt | Full quality report: overall score, grade, eight quality dimensions with the checks that failed, and every finding with why it matters and how to fix it. |
compare_prompts | Compare two prompts: token and estimated cost delta, quality delta per dimension, and which findings were resolved or introduced. |
scan_prompt_security | Prompt-injection risk (0-100, signature-based, with threat ids), sensitive-data counts by category, undelimited template variables, and destructive operations. Never returns detected secret values. |
scan_sensitive_data | Scan text for credentials, cloud secrets, and PII with local deterministic detectors. Returns offsets and per-category counts, never the sensitive values. |
sanitize_prompt | Replace detected sensitive data with placeholders such as [REDACTED_API_KEY]. Returns the sanitized text and counts, never the original values. Use before sending a prompt to an external model. |
restructure_prompt | Turn a loosely written request into a sectioned engineering prompt: Role, Objective, Context, Requirements, Constraints, Edge cases, Testing, Acceptance criteria, Expected output. Only sections with content appear. The author's clauses are kept and reordered; for software tasks, fixed engineering guidance chosen by intent and topic is added, and every line is labeled "prompt" or "engine" so additions can be reviewed. Set scaffold=false to reorganize without adding guidance. |
convert_structured_payload | Convert a JSON payload to TOON (Token-Oriented Object Notation) and say whether to use it. Returns token counts for pretty JSON, compact JSON and TOON, a round-trip check (the TOON must decode back to the same value), and the recommendation: "toon" only when it round-trips and saves at least 5 % over compact JSON, otherwise "json". Lossless or it keeps JSON. |
simulate_cost | Simulate what a prompt costs across models at a request volume, from catalog list prices (labelled simulated, never a bill). Optionally optimizes the prompt first and reports hypothetical savings. Flags models whose context window is too small. |
analyze_context_budget | Measure the context sources you intend to send with a prompt: tokens and share per source, context-window usage with an output reserve, sensitive data (categories and counts only), instruction-like text in retrieved sources, and duplicates. Reads only the text passed in; never reads files. |
run_prompt_tests | Run a regression suite against a prompt. Assertions check the prompt (contains, not_contains, matches, max_tokens, min_quality, no_finding, max_severity, has_variables, max_injection_risk, no_sensitive_data, output_format) and, when a case carries a recorded model response, the response (response_valid_json, response_has_keys, response_contains, response_max_chars). With baseline_prompt, also runs the suite on the baseline and lists cases that regressed. No model is called. |
功能介绍
Model Context Protocol 是 AI 应用调用外部工具的标准方式。PromptFlowEngine 提供一个 MCP 服务器,把引擎以工具的形式开放出来,因此 GitHub Copilot、Claude Desktop、Claude Code、Cursor 或你自己的客户端中的智能体无需定制的胶水代码即可使用它。
服务器作为客户端的子进程运行在你的电脑上,通过 stdio 使用 JSON-RPC 通信。它只读取收到的参数,不发起网络调用,也没有文件或 shell 工具。每个工具都标注为只读且幂等。
没有托管的端点,也无需配置身份验证。npm 包尚未发布,因此你需要从仓库构建服务器,并让客户端指向构建好的文件。如需远程使用,请调用 HTTP API。
实际示例
你的智能体可用的工具
这份列表在构建页面时由服务器自身的工具注册表生成,因此与客户端连接后看到的内容一致。 引擎的检查结果和生成的提示词以英文显示,与引擎和 API 返回的内容完全一致。
{
"servers": {
"promptflow": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/checkout/packages/mcp-server/dist/bin.js"]
}
}
}Use promptflow to restructure this before you start:
"fix login issue and make google login work and don't break anything"共 19 个工具,全部只读。其他客户端在 mcpServers 键下使用相同的命令。
主要优势
一份配置,多个客户端
同一个服务器条目可用于任何支持 stdio MCP 服务器的客户端。
可以放心交给智能体
没有文件、shell 或网络访问权限,因此即使智能体遭到提示词注入,也无法借助它访问任何东西。
确定性的工具结果
智能体用相同参数调用同一工具两次,会得到相同的答案。
智能体可据此行动的错误
参数错误时会返回附带原因的工具错误,智能体可以修正后重试。
功能
提示词工具
分析、验证、优化、重构、比较、估算 token、扫描和脱敏。
资源
规则目录和模型目录可作为 MCP 资源读取。
审查提示词
内置的 MCP 提示词会请助手评估并优化一个以数据形式传入的提示词。
大小限制
可配置每个参数可接受的字符数上限。
不含内容的日志
调试日志只记录工具名称、输入大小、结果和耗时,从不记录文本。
内置于 VS Code
VS Code 扩展在激活时会为你注册该服务器。
适用人群
- 使用编程智能体的开发者让智能体在开始编辑文件之前,先把模糊的任务重构为规格说明。
- 构建智能体的人为智能体提供一种确定性的方法,检查并脱敏它为子智能体或其他模型编写的提示词。
- 以 MCP 为标准的团队只需添加一个服务器条目,就能为每个 MCP 客户端加上提示词质量检查和密钥检测。
使用场景
- 01
先写规格再写代码
让智能体先用 promptflow 重构任务,然后按照验收标准来实现。
- 02
委派前先脱敏
让负责编排的智能体在把上下文交给其他模型或工具之前先进行脱敏。
- 03
检查生成的提示词
当智能体为子任务编写提示词时,验证它并自动修复严重问题。
- 04
规划 token 预算
让智能体在决定包含多少上下文之前,先估算草稿的 token 数。
常见问题
什么是 MCP 服务器?
MCP 服务器是通过 Model Context Protocol 向 AI 应用提供工具、资源和提示词的程序。AI 应用(称为客户端)决定何时调用它们。
它适用于哪些 MCP 客户端?
任何能够启动本地 stdio 服务器的客户端,包括 VS Code 中的 GitHub Copilot 智能体模式、Claude Desktop、Claude Code 和 Cursor。
有托管或远程的 MCP 端点吗?
没有。传输方式仅为 stdio,服务器运行在你的电脑上。如需远程访问,请使用 HTTP API。
服务器能读取我的文件吗?
不能。它没有文件、shell 或网络工具,只处理作为参数传给工具的文本。
PromptFlowEngine 的相关功能
所有产品都运行同一个引擎,组合使用时不会出现意外差异。
了解背后的技巧
来自提示词工程知识中心的指南,讲解本产品所运用的理念。