Part of #390.
Summary
Add kbagent flow examples (port of get_flow_examples) and, at the same time, fix the drifted hand-written flow schema by porting the authoritative flow JSON schemas.
MCP source (keboola-mcp-server @ agent-v1.60.0)
- Examples:
src/keboola_mcp_server/tools/flow/tools.py (get_flow_examples) loads static bundled files via importlib.resources:
resources/flow_examples/conditional_flow_examples.jsonl — 2 examples (for keboola.flow; string-UUID ids, graph next: [...]).
resources/flow_examples/legacy_flow_examples.jsonl — 2 examples (for keboola.orchestrator; integer ids, dependsOn: [...]).
- Gated:
keboola.flow examples require the project conditional_flows feature ('hide-conditional-flows' not in project_features).
- Schemas (sibling):
tools/flow/utils.py FLOW_SCHEMAS → static bundled flow-schema.json / conditional-flow-schema.json.
What kbagent already has
- Examples: nothing — no bundled files, no fetch path (there is no endpoint; bundling is the only option).
- Schema is drifted:
commands/flow.py _FLOW_SCHEMA is a hand-written triple-quoted string covering only keboola.flow, drifted independently from the MCP server's authoritative JSON schemas, with no orchestrator variant. flow_service.py has no schema/examples methods.
- Both flow types are already modelled:
_FLOW_COMPONENT_CHOICES = ["keboola.orchestrator", "keboola.flow"]; flow new/flow update already take --component-id for both.
Proposed command(s)
kbagent flow examples [--component-id keboola.orchestrator|keboola.flow]
Plus: replace _FLOW_SCHEMA with the bundled authoritative flow-schema.json + conditional-flow-schema.json, so flow schema [--component-id …] serves the correct schema per type.
Implementation sketch
- Bundle the two
.jsonl example files and the two schema JSON files copied from the MCP server into src/keboola_agent_cli/resources/flow_examples/ (+ schemas), loaded via importlib.resources. Add the data files to packaging (pyproject.toml / hatch include).
- L2 small loader in
flow_service.py returning the parsed list / schema per type.
- L1
flow examples thin command (dual output: JSON list of flow-config dicts; human = numbered JSON blocks). Update flow schema to read the bundled schema per --component-id.
Effort: M
Dominated by bundling static resource files + packaging + tests, not logic.
Acceptance criteria
Risks / open questions
- Static-bundle drift: copying examples/schemas forks a second copy that can rot — exactly the failure already present in
_FLOW_SCHEMA. Mitigate with a sync note/script; treat examples as illustrative. (No API to fetch them.)
- Feature gate: kbagent has no
conditional_flows/project_features plumbing today. Recommendation: ship ungated v1 (examples are static illustrative text; flow new already accepts both types), document that keboola.flow needs the feature. Adding the gate later is optional.
Part of #390.
Summary
Add
kbagent flow examples(port ofget_flow_examples) and, at the same time, fix the drifted hand-writtenflow schemaby porting the authoritative flow JSON schemas.MCP source (
keboola-mcp-server@agent-v1.60.0)src/keboola_mcp_server/tools/flow/tools.py(get_flow_examples) loads static bundled files viaimportlib.resources:resources/flow_examples/conditional_flow_examples.jsonl— 2 examples (forkeboola.flow; string-UUID ids, graphnext: [...]).resources/flow_examples/legacy_flow_examples.jsonl— 2 examples (forkeboola.orchestrator; integer ids,dependsOn: [...]).keboola.flowexamples require the projectconditional_flowsfeature ('hide-conditional-flows' not in project_features).tools/flow/utils.pyFLOW_SCHEMAS→ static bundledflow-schema.json/conditional-flow-schema.json.What kbagent already has
commands/flow.py_FLOW_SCHEMAis a hand-written triple-quoted string covering onlykeboola.flow, drifted independently from the MCP server's authoritative JSON schemas, with no orchestrator variant.flow_service.pyhas no schema/examples methods._FLOW_COMPONENT_CHOICES = ["keboola.orchestrator", "keboola.flow"];flow new/flow updatealready take--component-idfor both.Proposed command(s)
Plus: replace
_FLOW_SCHEMAwith the bundled authoritativeflow-schema.json+conditional-flow-schema.json, soflow schema [--component-id …]serves the correct schema per type.Implementation sketch
.jsonlexample files and the two schema JSON files copied from the MCP server intosrc/keboola_agent_cli/resources/flow_examples/(+ schemas), loaded viaimportlib.resources. Add the data files to packaging (pyproject.toml/ hatchinclude).flow_service.pyreturning the parsed list / schema per type.flow examplesthin command (dual output: JSON list of flow-config dicts; human = numbered JSON blocks). Updateflow schemato read the bundled schema per--component-id.Effort: M
Dominated by bundling static resource files + packaging + tests, not logic.
Acceptance criteria
kbagent flow examples --component-id keboola.flowand…keboola.orchestratoreach return their examples.flow schema --component-id …serves the authoritative schema for both flow types (orchestrator variant added).--jsonemits structured dicts.Risks / open questions
_FLOW_SCHEMA. Mitigate with a sync note/script; treat examples as illustrative. (No API to fetch them.)conditional_flows/project_featuresplumbing today. Recommendation: ship ungated v1 (examples are static illustrative text;flow newalready accepts both types), document thatkeboola.flowneeds the feature. Adding the gate later is optional.