Skip to content

feat: add get_contract_process_metrics tool#54

Draft
sd-gh-bot wants to merge 1 commit intomainfrom
feat/get-contract-process-metrics
Draft

feat: add get_contract_process_metrics tool#54
sd-gh-bot wants to merge 1 commit intomainfrom
feat/get-contract-process-metrics

Conversation

@sd-gh-bot
Copy link
Copy Markdown
Contributor

@sd-gh-bot sd-gh-bot commented May 4, 2026

User description

Summary

Adds a new read tool get_contract_process_metrics backed by GET /v2.1/public/contracts/{contract_id}/process_metrics/.

Motivation

The sidebar agent entered a 73+ sub-call retry loop when asked for signing timelines on 10 contracts. No existing MCP tool exposed signing timestamps — the agent repeatedly tried get_contract_activity_log (which only returns user-written comments) and get_contract_status (which returns no timestamps at all), spending 3 min 25 sec on a single reply.

This tool fills that data gap.

New tool: get_contract_process_metrics

Response field Meaning
marked_for_signature_datetime When signing was initiated
contract_executed_datetime When all parties signed
contract_sent_to_cp_datetime When sent to counterparty
cp_opened_review_email_datetime When CP first opened the review email
contract_signed_by_signatory_list Per-signatory email + signed timestamp
contract_turns.no_of_turns Negotiation turn count
pending_with Which party currently holds the ball

The tool description explicitly steers agents away from get_contract_activity_log for timeline queries and documents the integer-only ID requirement (no T-/H- prefix).

Also changed

  • src/tools/contracts/AGENTS.md: clarifies get_contract_activity_log returns user comments only (not workflow events), and adds get_contract_process_metrics to the public surface table.
  • CHANGELOG.md: documents the addition under [Unreleased].

Files changed

  • src/tools/contracts/get_contract_process_metrics.ts ← new tool
  • src/tools/index.ts ← registration
  • src/tools/contracts/AGENTS.md ← updated
  • CHANGELOG.md ← updated

Validation

  • npm run build passes cleanly (TypeScript + chmod step)
  • Compiled output confirmed in build/tools/contracts/get_contract_process_metrics.js
  • Tool correctly registered in build/tools/index.js

Generated description

Below is a concise technical summary of the changes proposed in this PR:
Add get_contract_process_metrics read tool that fetches workflow timeline timestamps and process measurements via the SpotDraft client for any contract. Document and expose the tool in guidance materials, steering agents away from get_contract_activity_log when they need signing and execution timelines.

TopicDetails
Tooling docs Clarify that get_contract_activity_log only surfaces user comments, add the new tool to the public surface, and record the change in the changelog.
Modified files (2)
  • CHANGELOG.md
  • src/tools/contracts/AGENTS.md
Latest Contributors(2)
UserCommitDate
neo@spotdraft.comfeat: add get_contract...May 04, 2026
aditya-gupta-sdedocs: Add modular AGEN...April 21, 2026
Contract metrics tool Highlight the new get_contract_process_metrics tool and register it so agents can fetch contract timeline timestamps and process metrics through the SpotDraft client.
Modified files (2)
  • src/tools/contracts/get_contract_process_metrics.ts
  • src/tools/index.ts
Latest Contributors(2)
UserCommitDate
neo@spotdraft.comfeat: add get_contract...May 04, 2026
vinit@spotdraft.comadded support to get l...April 28, 2026
This pull request is reviewed by Baz. Review like a pro on (Baz).

Adds a new read tool backed by GET /v2.1/public/contracts/{contract_id}/process_metrics/.

Motivation: the sidebar agent entered a 73+ sub-call retry loop when asked
for signing timelines on 10 contracts (trace 019bbb80, nykaa/vivek.jha).
No existing MCP tool exposed signing timestamps; the agent repeatedly tried
get_contract_activity_log (which only returns user comments) and
get_contract_status (which returns no timestamps).

The new tool surfaces:
- marked_for_signature_datetime  (signing initiated)
- contract_executed_datetime     (all parties signed)
- contract_sent_to_cp_datetime   (sent to counterparty)
- contract_signed_by_signatory_list (per-signatory timestamps)
- contract_turns.no_of_turns     (negotiation turn count)
- pending_with                   (who currently holds the ball)

The tool description explicitly redirects agents away from
get_contract_activity_log for timeline queries and documents the
integer-only ID requirement (no T-/H- prefix).

Also updates AGENTS.md to clarify that get_contract_activity_log returns
user comments only, not workflow events.

Co-authored-by: Jaskaran Bhatia <jaskaran@spotdraft.com>
@sachin-spotdraft sachin-spotdraft added the size/m < 500 lines of changes label May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m < 500 lines of changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants