Skip to main content
Glama

update_task_context

Merge keys into persistent task context, preserving other keys. Use expected_version to guard concurrent writes, and keep a compact current state for AI agents.

Instructions

Merge keys into persistent task context, preserving other keys. Keep a compact current_state/next_step and retrieve history only when needed. Pass expected_version from get_task_context to guard concurrent writes. Returns a compact acknowledgment, not merged history. A conflict applies no write: read the relevant current keys, merge and retry explicitly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceNoAttribution source for this context write. Defaults to agent_inferred.
contextYesObject whose keys are merged (not replaced) into existing context
task_idYesThe task ID whose context to update
expected_versionNoOptimistic concurrency guard: the context version returned by get_task_context. Omit for an unguarded merge.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.19.0
    • removedInput schema / properties / task_id / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  }
      -]
    • addedInput schema / properties / task_id / type
      Added value: +[
      +  "string",
      +  "number"
      +]
  2. Changed2 schema fields changedv1.9.0
    • addedInput schema / properties / expected_version
      Added value: +{
      +  "description": "Optimistic concurrency guard: the context version returned by get_task_context. Omit for an unguarded merge.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / source
      Added value: +{
      +  "description": "Attribution source for this context write. Defaults to agent_inferred.",
      +  "enum": [
      +    "human_stated",
      +    "agent_inferred",
      +    "agent_observed",
      +    "imported"
      +  ],
      +  "type": "string"
      +}
  3. Addedv1.2.1

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden and does so: it discloses merge-vs-replace semantics, optimistic concurrency via expected_version, atomic conflict behavior (a conflict applies no write), and the shape of the response (compact acknowledgment, not merged history). This is unusually complete disclosure for a mutation tool.

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?

Five tight sentences, front-loaded with what the tool does, followed by usage, concurrency guidance, return shape, and conflict handling. No sentence is redundant or padded.

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?

Despite having no annotations and no output schema, the description covers mutation semantics, return value, concurrency guard, and conflict resolution. An agent has everything needed to call it correctly and to react to failures.

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?

Schema description coverage is 100%, so the schema already documents task_id, context, source, and expected_version, making 3 the baseline. The description adds useful meaning beyond the schema by tying expected_version to its source (get_task_context) and framing it as a guard against concurrent writes, plus the merge-and-retry procedure when it fails.

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 states a precise verb+resource pair (merge keys into persistent task context) and immediately distinguishes the operation from its siblings by specifying merge-not-replace semantics, which separates it from get_task_context and get_context_history.

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?

It gives explicit when-to-use guidance (keep a compact current_state/next_step, retrieve history only when needed) and names the concrete alternative for history via the get_task_context/get_context_history flow. It also prescribes the failure path: on conflict, read current keys, merge and retry explicitly.

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