Skip to main content
Glama

complete_contract

Finalize a teaching contract by recording a completion note once every covered course is completion-ready, preventing invalid completions and ensuring idempotent replay.

Instructions

把一份合约收作结业 (State 2.0 文书三幕剧: 立约 → 履约 → 结业, 迁移 0030) —— completed_at/completion_note 是与 established(签约)/voided(作废)并列的第三种终态, 不是覆盖关系。completion_note 是结业词——给这段学习旅程的证词, 认真写, 不是流程按钮上敷衍一句"完成了"。前置校验, 任一条不满足即结构化拒绝并附差额: ① 合约现役(经 lib/currentContract 判定路径——未签/已作废/已过终态一律拒绝); ② covered_course_ids 非空(先 update_contract_coverage 或建课时带 contract_id 把教过的课挂上); ③ 覆盖单里每门课须 goal_completion_ready (见 get_context 的 contract_progress) —— 全部已发布课 learning 状态 ∈ {completed_declared, closed} (未发布的课不计入), 且课程定过 planned_lesson_count 并已发布节数够数——没定过计划节数的课不再放行。不满足则回执附结构化差额, 分两种: 缺 planned_lesson_count (missing_planned_count) 或已发布节数不足计划 (below_planned_count), 外加"哪门课还差几节未读完"的清单, 不是一句"没教完"。幂等: 已结业的合约重复调用原样返回既有结业词, 不报错、不二次写入。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_idYes必须是已存在的 teaching_contracts id.
completion_noteYes结业词(必填非空)——这段学习旅程的证词, 认真写.
idempotency_keyNo可选。幂等键 (建议 uuid) —— 同一 key 重放此调用返回首次结果, 不重复写入. 网络重试/断线重连时带上同一个 key, 而不是猜"上次到底写没写".
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so excellently. It discloses strict validation behavior with structured rejection and detailed diffs (two failure types), idempotency (repeated calls return existing result without error or duplicate write), and the semantics of the completion_note as a serious testimony. It also explains the final-state nature, making the mutation's effects clear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but every sentence earns its place. It is front-loaded with the primary action, then systematically covers state distinction, note expectations, preconditions, failure modes, and idempotency. Numbered lists and clear separation of concerns make it easy to parse despite its density. No fluff or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

This is a complex mutation tool with strict preconditions, failure modes, and idempotency behavior. The description covers all these aspects, references related tools (update_contract_coverage, get_context), describes rejection response structure, and explains the repeated-call behavior. No output schema exists, so the description sufficiently explains what to expect. It is effectively complete for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema covers all parameters at 100%, so the baseline is 3. The description adds value by elaborating on completion_note's intent ('不是流程按钮上敷衍一句') and idempotency_key's use in retries ('网络重试/断线重连时带上同一个 key'), going beyond the schema's descriptions. However, it does not add significant new meaning for contract_id beyond the schema. Thus a 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a clear, specific verb+resource: '把一份合约收作结业' (close a contract as completed). It distinguishes this from sibling tools like void_contract by explaining it is the third terminal state (completed_at/completion_note) alongside established/voided, and explicitly notes it is not an override relationship. This makes the tool's purpose unambiguous and well-differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit when-to-use and when-not-to-use guidance. It states preconditions required before calling (contract active, covered_course_ids non-empty, each course goal_completion_ready) and names alternative/upstream tools ('先 update_contract_coverage', '见 get_context 的 contract_progress'). It also clarifies that voided or already-terminal contracts are rejected, implicitly distinguishing from void_contract. This is comprehensive usage guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sf-shenfeng/learn-shell'

If you have feedback or need assistance with the MCP directory API, please join our Discord server