Skip to main content
Glama

gograph_concurrency

Read-onlyIdempotent

Find indexed concurrency sites—goroutine spawns, channel sends, and sync.Mutex/RWMutex/WaitGroup/Once calls—or inspect a function's lock scopes to audit race safety and plan refactors.

Instructions

Find indexed concurrency sites in the codebase: goroutine spawns (go statements), channel sends, and calls on sync.Mutex/RWMutex, sync.WaitGroup, and sync.Once. Optional term filter (e.g., "mutex", "goroutine", "channel"). WHEN TO USE: When auditing race safety, understanding async flow, or locating synchronization points before a concurrency refactor. NOT TO USE: For standard sequential call flow analysis (use gograph_callers/gograph_callees). RETURNS: File locations, line numbers, and primitive kind for each indexed concurrency site; empty when no sites are found. Channel receives and select statements are not indexed. LOCK SCOPE: pass function (a function or method selector) instead of term to parse that body now and list each Lock/RLock with its release (unlock lines, deferred until return, or not released) and the calls between lock and release; spans are lexical, and a call after an unlock in the same block (an early-return branch) is not listed.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "gograph_concurrency"
  }
}

Input Schema

NameRequiredDescriptionDefault
rootNoAbsolute path of your checkout or worktree (alias cwd).
termNoOptional filter term (e.g., 'goroutine', 'mutex', 'channel')
limitNoRows per page.
cursorNonext_cursor from the previous page.
functionNoFunction or method selector (e.g., 'Manager.startPass'); returns its lock scopes instead of the site list
intentionNoRationale; required with an active session.
session_idNoSession from session_create; omit for none.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.7.26
    • addedInput schema / properties / function
      Added value: +{
      +  "description": "Function or method selector (e.g., 'Manager.startPass'); returns its lock scopes instead of the site list",
      +  "type": "string"
      +}
  2. Changed5 schema fields changedv1.7.21
    • changedInput schema / properties / cursor / description
      Previous value: -"Opaque next_cursor for the same graph snapshot and result selection."New value: +"next_cursor from the previous page."
    • changedInput schema / properties / intention / description
      Previous value: -"Technical rationale, required for analytical calls selecting an active session."New value: +"Rationale; required with an active session."
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum rows per page; the byte budget may return fewer."New value: +"Rows per page."
    • changedInput schema / properties / root / description
      Previous value: -"Absolute path of the checkout you are working in (your cwd or git worktree). Must be this server's repository or one of its git worktrees; the answer then comes from that checkout's own graph. A path elsewhere is refused. Alias: cwd. Omit only when the configured checkout is the one you mean."New value: +"Absolute path of your checkout or worktree (alias cwd)."
    • changedInput schema / properties / session_id / description
      Previous value: -"Caller selector returned by session_create. Omission means an independent caller; never inherits server environment or another caller's session."New value: +"Session from session_create; omit for none."
  3. Changed3 schema fields changedv1.7.18
    • addedInput schema / properties / intention
      Added value: +{
      +  "description": "Technical rationale, required for analytical calls selecting an active session.",
      +  "type": "string"
      +}
    • addedInput schema / properties / root
      Added value: +{
      +  "description": "Absolute path of the checkout you are working in (your cwd or git worktree). Must be this server's repository or one of its git worktrees; the answer then comes from that checkout's own graph. A path elsewhere is refused. Alias: cwd. Omit only when the configured checkout is the one you mean.",
      +  "type": "string"
      +}
    • addedInput schema / properties / session_id
      Added value: +{
      +  "description": "Caller selector returned by session_create. Omission means an independent caller; never inherits server environment or another caller's session.",
      +  "type": "string"
      +}
  4. Changed2 schema fields changedv1.7.5
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "Opaque next_cursor for the same graph snapshot and result selection.",
      +  "maxLength": 128,
      +  "type": "string"
      +}
    • addedInput schema / properties / limit
      Added value: +{
      +  "default": 100,
      +  "description": "Maximum rows per page; the byte budget may return fewer.",
      +  "maximum": 200,
      +  "minimum": 1,
      +  "type": "integer"
      +}
  5. Addedv1.5.3
  6. Removedv1.5.3
  7. First observedv1.0.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, closed-world), but the description adds substantive behavior the annotations do not: empty results when no sites exist, the exclusion of channel receives and select statements, and the LOCK SCOPE parsing semantics with its lexical-span caveat that an early-return branch after an unlock is not listed. The only shortfall is silence on pagination behavior for the list mode.

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

Conciseness4/5

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

Front-loaded with the core definition, then clearly segmented by caps labels (WHEN TO USE, NOT TO USE, RETURNS, LOCK SCOPE). It is dense and the `term` example list partially repeats the schema, but almost every sentence adds real decision-relevant information.

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

Completeness4/5

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

For a 7-parameter read-only tool with no output schema, the description fully documents the return payload (file locations, line numbers, primitive kind) and the dual modes. Minor gaps remain on pagination and on the session/intention prerequisites for the mutating-looking parameters.

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 coverage is 100%, so baseline is 3, and the description earns above baseline by explaining the `function` versus `term` tradeoff and the shape of what `function` returns (each Lock/RLock with release mode). It stops short of explaining `limit`/`cursor` pagination or the `root`/`session_id` governance, which it leaves entirely to the schema.

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 specific verb and resource ('Find indexed concurrency sites') and enumerates exactly what counts as a site: `go` statements, channel sends, and calls on sync.Mutex/RWMutex, WaitGroup, Once. It also explicitly states what is NOT indexed (channel receives, select statements), so an agent can distinguish this from gograph_callers/callees without opening a schema.

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?

Provides an explicit WHEN TO USE (race audits, async flow, locating synchronization points before a refactor) and an explicit NOT TO USE that names the sibling alternatives for sequential flow analysis. It additionally routes between its own two modes: `function` for lock-scope parsing versus `term` for the site list.

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