Skip to content

More writing tools#40

Draft
codebreach wants to merge 4 commits intomainfrom
readwrite-2
Draft

More writing tools#40
codebreach wants to merge 4 commits intomainfrom
readwrite-2

Conversation

@codebreach
Copy link
Copy Markdown
Contributor

@codebreach codebreach commented Mar 24, 2026

User description

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):


Generated description

Below is a concise technical summary of the changes proposed in this PR:
Document how the handler/server pipeline and SpotDraftClient now gate write tools, emit structured MCP errors, and expose write mode state so clients can enable SD_MCP_ENABLE_WRITE or enable_write=true before calling write helpers. Describe how the README and tool registry now explain the new upload/approval/comment/send helpers along with their validation/auth documentation.

TopicDetails
Contract write workflows Enable the full suite of contract write helpers, discovery docs, and validation/auth lookups so the tool registry can list the new write-only tools (upload_contract_version, send_contract_to_counterparties, create_contract_approvals, add_contract_comment, upload_executed_contract, upload_contract_for_review, upload_contract_for_signature, create_contract_from_template) only when permitted, and the supporting utilities (auth_lookup, validate_ids, spotdraft_questionnaire_value_docs) keep their inputs consistent.
Modified files (14)
  • src/tools/contract-types/get_intake_form_questionnaire.ts
  • src/tools/contracts/add_contract_comment.ts
  • src/tools/contracts/create_contract_approvals.ts
  • src/tools/contracts/create_contract_from_template.ts
  • src/tools/contracts/send_contract_to_counterparties.ts
  • src/tools/contracts/upload_contract_for_review.ts
  • src/tools/contracts/upload_contract_for_signature.ts
  • src/tools/contracts/upload_contract_version.ts
  • src/tools/contracts/upload_executed_contract.ts
  • src/tools/index.ts
  • src/tools/organizations/get_organization_entities.ts
  • src/utils/auth_lookup.ts
  • src/utils/spotdraft_questionnaire_value_docs.ts
  • src/utils/validate_ids.ts
Latest Contributors(1)
UserCommitDate
madhav@spotdraft.comfeat: Introduce write ...March 23, 2026
Other Other files
Modified files (1)
  • src/tools/templates/get_template_metadata.ts
Latest Contributors(1)
UserCommitDate
achuth10chore: Refactor projec...February 05, 2026
Docs & setup Document the new write capabilities, activation flags, and OAuth setup so users know that the write-only tools only appear when SD_MCP_ENABLE_WRITE (or enable_write=true) is set alongside the existing tooling instructions.
Modified files (1)
  • README.md
Latest Contributors(2)
UserCommitDate
madhav@spotdraft.comchore: Update version ...March 24, 2026
achuth10chore: Defluff README ...February 10, 2026
Write access control Enforce write-mode gating and structured error handling across the MCP stack so handler, HTTP/stdio servers, SpotDraftClient, ToolRegistry, and MCP errors surface contextual fields, serialize unknown failures, and return WRITE_DISABLED instead of exposing write-only registry entries when write_mode is off.
Modified files (9)
  • src/errors/index.ts
  • src/errors/types.ts
  • src/handler.ts
  • src/servers/http_server.ts
  • src/servers/stdio_server.ts
  • src/spotdraft_client.ts
  • src/tools/types.ts
  • src/utils/error_serialization.ts
  • src/utils/write_mode.ts
Latest Contributors(2)
UserCommitDate
madhav@spotdraft.comfeat: Introduce write ...March 23, 2026
achuth10chore: Refactor projec...February 05, 2026
This pull request is reviewed by Baz. Review like a pro on (Baz).

codebreach and others added 4 commits March 15, 2026 01:16
- Added new write tools: `upload_contract_version`, `send_contract_to_counterparties`, `create_contract_approvals`, and `add_contract_comment`.
- Updated the README to document write tools and how to enable write mode via query parameters or environment variables.
- Enhanced the tool registry to conditionally include write tools based on the write mode status.
- Implemented error handling for attempts to invoke write tools when write mode is disabled, returning a `WriteDisabledError`.
- Updated API error handling to provide more context on upstream errors.

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1. auth_lookup: resolveRoleNameToId throws ValidationError on multiple
   matches with colliding names in metadata for agent disambiguation
2. spotdraft_client: extract buildApiErrorMessage helper to deduplicate
   error message logic between get and post
3. write_mode: request-scoped write mode via AsyncLocalStorage; no
   global mutation from applyWriteModeFromRequest; HTTP uses
   runWithWriteModeAsync with per-request includeWrite
4. write_mode: parseTruthyQueryParam for query normalization
   (true/1/yes, arrays, booleans)
- Introduced new write tools: `upload_executed_contract`, `upload_contract_for_review`, and `upload_contract_for_signature`.
- Updated the README to include descriptions for the new upload tools and their requirements.
- Enhanced the tool registry to register the new upload tools, ensuring they are available when write mode is enabled.
- Adjusted existing documentation to reflect the expanded capabilities of write tools.
- Introduced a new tool: `create_contract_from_template`, allowing users to create contracts from SpotDraft templates.
- Updated the README to include detailed descriptions and requirements for the new tool.
- Enhanced error handling in the SpotDraft client and tool handlers to provide more structured error responses.
- Improved documentation for existing tools to clarify input requirements and encoding formats for `intake_form_data`.
- Added utility functions for error serialization to improve logging and client context.
@codebreach
Copy link
Copy Markdown
Contributor Author

@codex rebase this

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex couldn't complete this request. Try again later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants