feat(mcp): discovery/validate/dry-run/run meta-tools + Glama metadata - #44
Conversation
…data The MCP server previously exposed only one tool per workflow file, so an empty directory produced zero tools (nothing to introspect or grade) and an agent could run a workflow but not discover, validate, or preview one. - Add four always-present, well-described meta-tools with correct MCP annotations: list_workflows, validate_workflow, dry_run_workflow (all read-only) and run_workflow (destructive). tools/list is now non-empty even with an empty directory. - Fix a latent bug: per-workflow execution called engine.run(**arguments), but run()'s signature is run(params=...); parameterized workflows would have raised TypeError. Now passes params correctly. - Capture engine stdout (e.g. the dry-run preview) so it cannot corrupt the stdio JSON-RPC stream; return it as 'preview' for dry runs. - Keep the per-workflow convenience tools (additive). - Add glama.json (maintainer: orieg) for Glama server verification. - Docs: document the tool model; tests for resolve/validate/execute helpers. Verified end-to-end over MCP stdio: 4 meta-tools list with an empty dir; run_workflow and per-workflow tools execute with params.
There was a problem hiding this comment.
Pull request overview
This PR expands the MCP server surface so agents can discover, validate, preview (dry-run), and run workflows via four always-present “meta-tools”, while preserving the existing per-workflow convenience tools. It also adds Glama metadata and updates docs/tests to reflect and verify the new tool model.
Changes:
- Add four meta-tools (
list_workflows,validate_workflow,dry_run_workflow,run_workflow) with MCP annotations and richer descriptions. - Fix workflow execution parameter passing (engine
run(params=...)) and capture stdout to protect the JSON-RPC stream (returning dry-run output aspreview). - Add
glama.json, document the tool model, and add tests for workflow resolution/validation/execution helpers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/yaml_workflow/mcp_server.py |
Introduces meta-tools, workflow resolution/validation/execute helpers, annotations, and updated dispatch logic. |
tests/test_mcp_server.py |
Adds unit tests for the new helper functions and dry-run preview behavior. |
docs/guide/mcp.md |
Updates documentation to describe the meta-tools + per-workflow tool model and MCP annotations. |
glama.json |
Adds Glama server metadata for verification/scoring. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- list_workflows description now says it returns an object with {count,
workflows} (matching the actual return), not an array
- dry_run_workflow no longer claims 'no files are written': it does not
execute tasks or cause the workflow's side effects, but writes ephemeral
logs to a temporary workspace — description + docs corrected to match the
read-only annotation without contradiction
|
Addressed all three in df6ecb4: |
Summary
Makes the MCP server a first-class agent surface — and prepares it for a Glama A-grade (the awesome-mcp-servers badge gate) by ensuring
tools/listis non-empty and every tool is well-described with correct annotations.Previously the server exposed only one tool per workflow file, so:
Changes
Four always-present meta-tools with rich, Glama-graded descriptions and correct MCP annotations:
list_workflowsvalidate_workflowdry_run_workflowrun_workflowDescriptions and
readOnlyHint/destructiveHintagree (no contradictions — a Glama scoring axis).Latent bug fixed: per-workflow execution called
engine.run(**arguments), but the signature isrun(params=...)— any parameterized workflow would have raisedTypeError. Now passes params correctly.stdio safety: engine stdout (e.g. the dry-run preview) is captured so it can't corrupt the JSON-RPC stream; returned as
previewfor dry runs.Per-workflow convenience tools kept (additive — no behavior removed).
glama.jsonat repo root (maintainerorieg) for Glama server verification.Docs (
mcp.md) document the tool model; new tests cover the resolve/validate/execute helpers.Verification
black/isort/mypyclean.run_workflow {who: Alice}→hi Alice; per-workflow tool →hi Bob.Follow-up (needs maintainer's Glama login — Part 2/3 of the playbook)
After this merges + a release: claim the server on glama.ai, sync, configure the build (point
--dirat an empty dir so only the four polished meta-tools are graded), build + publish a release to get the score, then append the Glama score badge to the awesome-mcp-servers PR entry (held pending the badge).