update
Purpose
Re-validate the configuration, clear the cache, and re-download all spec files. This is a full refresh of the workspace — it ensures all cached specs are up to date and the index is rebuilt.
When to use
- Remote spec files have changed and you want the latest version
- After editing
swag2mcp.yamlto add or change spec locations - When troubleshooting stale or corrupted cache
- Before running
mcpto ensure everything is fresh
Syntax
bash
swag2mcp update [path]Arguments
| Argument | Position | Required | Description |
|---|---|---|---|
path | 1 | No | Workspace directory. If omitted, resolves via path resolution rules. |
Flags
None.
How it works
The update command runs a pipeline of operations:
- Load config — reads
swag2mcp.yamlfrom the workspace - Validate — runs the same checks as
validate(YAML syntax, structure, spec file reachability, format, auth, HTTP client) - Clean — removes all contents of
cache/andresponses/ - Re-cache — downloads all remote spec files and copies local spec files into the cache
- Re-index — rebuilds the full-text search index for all endpoints
- Auth scripts — creates stub auth scripts for specs using
ScriptAuth - Orphan cleanup — removes auth scripts for specs that no longer exist
bash
swag2mcp update
swag2mcp update ./my-workspaceWhat happens to disabled collections
Collections with disable: true are skipped entirely — they are not cached or indexed.
Post-command verification
bash
swag2mcp ls [path]
# All specs should still be listed and reachableNuances
- No auto-init: If the config file does not exist,
updatereturns an error:"configuration not found at <path>". Runinitfirst. - Network dependency: All remote spec URLs must be reachable. If any download fails, the entire update fails with a clear error message.
- Auth script creation: If a spec uses
ScriptAuthand the stub script doesn't exist,updatecreates it. If creation fails, the update fails. updatevsclean:cleanonly removes cache.updateremoves cache and re-downloads everything. Usecleanwhen you just want to free space; useupdatewhen you want to refresh.