Skip to main content
Glama

Find or create organizational context

dm.ensure_context
Idempotent

Idempotently find or create one Project, Decision Thread, Repository Scope or Environment by its normalized name and return its canonical id with created=true|false. Requires the delegated human's OAuth grant and a workspace role that permits the change. Repository Scopes are name-only: nothing is connected, fetched, cloned or indexed. If several items already match, it returns ambiguous_match with candidate ids instead of choosing one.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "kind": "<kind>",
      "name": "<name>"
    },
    "name": "dm.ensure_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyNoProject only: explicit short key. Derived from the name when omitted.
kindYes
nameYesDisplay name (thread title for decision_thread). Matched by normalized name.
project_idNoDecision thread only: scope the match to this project and link a newly created thread to it. Omitted: the match spans the whole workspace and a new thread is created without a project.
descriptionNoDecision thread only: used when the thread is created; never overwrites an existing one.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the annotations (idempotent, non-destructive, closed-world), the description discloses that Repository Scopes are name-only with nothing connected, fetched, cloned or indexed, that permissions and an OAuth grant are required, that a provided description never overwrites an existing thread, and that multiple matches return ambiguous_match with candidate ids rather than a silent pick. Those are exactly the non-obvious behaviors an agent must know before calling a write 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?

Three sentences, each carrying unique information: the operation and return contract first, then the permission prerequisites, then the two edge cases (name-only repository scopes, ambiguity handling). No restatement of the tool name or filler.

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?

With five parameters, one enum and no output schema, the definition still tells the agent what comes back (canonical id, created flag, or ambiguous_match with candidates) and what preconditions apply. Nothing needed to invoke it correctly is missing.

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

Parameters3/5

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

Schema coverage is 80% and the parameter descriptions already explain key derivation, decision-thread scoping via project_id, and description-on-create-only. The description adds the matching rule (normalized name) and confirms created=true|false, but most parameter meaning already lives in the schema, so this is baseline territory.

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?

Names a precise verb (idempotently find or create) plus the exact resource set (Project, Decision Thread, Repository Scope, Environment) and states the return contract (canonical id with created=true|false). That distinguishes it cleanly from siblings like dm.list_context, dm.get_decision_context and dm.update_context, which read or mutate existing items only.

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

Usage Guidelines4/5

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

The idempotent find-or-create framing tells the agent clearly when this tool applies, and it adds prerequisites (delegated human OAuth grant, workspace role permitting the change). It does not explicitly name an alternative or an exclusion (e.g. use dm.list_context to read without creating), so it stops short of full routing guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources