feat(mcp): default create_purchase_order to DRAFT status#878
Open
dougborg wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the MCP create_purchase_order tool so that newly created purchase orders default to DRAFT (instead of relying on Katana’s API default of NOT_RECEIVED), aligning programmatic PO creation with an “operator-review-first” workflow.
Changes:
- Set
CreatePurchaseOrderRequest.statusdefault to"DRAFT"and ensure the apply path sendsDRAFTexplicitly when unspecified. - Update preview responses and tool/docs text to reflect the new default and explain how to opt out (
status="NOT_RECEIVED"). - Add regression tests covering (a) default-to-DRAFT behavior and (b) explicit
NOT_RECEIVEDforwarding.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| katana_mcp_server/src/katana_mcp/tools/foundation/purchase_orders.py | Changes the request default, apply-path API payload behavior, preview card status, and expands status documentation. |
| katana_mcp_server/tests/tools/test_purchase_orders.py | Adds regression tests asserting the new default behavior and explicit override behavior. |
| katana_mcp_server/src/katana_mcp/resources/help.py | Updates katana://help documentation to reflect DRAFT as the default and clarify semantics. |
New POs created via create_purchase_order now land in DRAFT — an unsent draft the operator can review and edit before committing the order to the supplier — instead of NOT_RECEIVED. An API-created PO that a human hasn't approved is conceptually a draft, not an already-placed order; the previous default forced a manual "send back to draft" fixup in the Katana UI on every programmatically created PO. - Flip the `status` field default from None (→ Katana's NOT_RECEIVED) to "DRAFT", and send DRAFT explicitly on the apply path rather than leaving it UNSET. - Reflect DRAFT on the preview card so the operator sees the target state. - Expand the `status` field + tool docstring + katana://help entry to enumerate DRAFT vs NOT_RECEIVED, how to opt out (status="NOT_RECEIVED" for already-placed orders), and how to transition later (modify_purchase_order / receive_purchase_order). - Add regression tests pinning the DRAFT default (apply + preview) and that an explicit NOT_RECEIVED still forwards unchanged. Callers wanting an already-ordered PO pass status="NOT_RECEIVED" explicitly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c0b13b0 to
2b47492
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create_purchase_ordernow creates new POs in DRAFT by default instead ofNOT_RECEIVED. An API-created PO that a human hasn't approved is conceptually anunsent draft — the operator can review and edit it before committing the order to
the supplier. The previous default forced a manual "send back to draft" fixup in
the Katana UI on every programmatically created PO (5–6 per StockTrim split).
DRAFT support itself already shipped in client v0.50.0 (Apr 9); this PR only
flips the default and clarifies the docs.
Changes
statusfield defaultNone(→ Katana'sNOT_RECEIVED) →"DRAFT",and send
DRAFTexplicitly on the apply path rather than leaving itUNSET.DRAFTso the operator sees the target state.statusfield description, tool docstring, andkatana://helpentry to enumerate
DRAFTvsNOT_RECEIVED, how to opt out(
status="NOT_RECEIVED"for already-placed orders), and how to transitionlater (
modify_purchase_order/receive_purchase_order).NOT_RECEIVEDstill forwards unchanged.Opt-out
Callers wanting an already-ordered PO pass
status="NOT_RECEIVED"explicitly.Test plan
uv run poe check— 3783 passed, 8 skipped + 42 browser tests passedNOT_RECEIVED forwarding
inputSchemaadvertises"default": "DRAFT"with the["DRAFT", "NOT_RECEIVED"]enum end-to-end(affects all PO creation lacking an explicit status — StockTrim split,
correct_purchase_order, etc.)🤖 Generated with Claude Code