Skip to main content
Glama

find_indirect_call_sites

Locate indirect calls made through a C/C++ function pointer field, variable, or callable object, and see which functions each call reaches. Read-only query for tracing function pointer invocations.

Instructions

Find the indirect calls through a C/C++ function pointer field or variable, or the indirect calls that a function makes, with the functions that each call reaches.

An indirect call goes through a slot: a field, a variable, a parameter or the return value of a function that holds a function (driver.onData(buf, len), g_cb(42), handlers[i](x)), or the operator() of a std::function or another callable object. For a field or a variable, the answer holds each call through it, also through a copy of its value (cb_t f = dev->on_rx; f(1);).

Read-only. No side effects. Use this to answer "where is this function pointer invoked, and what does it call?" as opposed to find_callers which answers "who calls this function?" (an indirect call that reaches it is a "call" row there, origin "slot" or "type_only"). For the functions that a pointer can hold, and where the code stores them, use find_indirect_targets.

Requires the reference index (fw-context index — refs on by default).

Args: name: A function pointer field or variable, or a function, method or lambda. Resolved as every symbol tool resolves a name (qualified name, bare name, suffix); a name of several symbols answers for each of them. A parameter is no symbol: ask with its function. project_root: Project root directory. Auto-detected if omitted. project: Project name or project_id — call list_projects to get them. Use it to ask about a project that is not the project of the current directory. It is an alternative to project_root, which takes a root path. Give one of the two, not both. limit: Maximum results (default 50, max 200). offset: Skip this many results. Reads the next page; the page notice names the offset to use. variant: Variant of the build (a board, or a PlatformIO environment). On a project of more than one build, give the arguments of one build as the refusal lists them: the variant, the image, or the two. fw-context does not select a build. One query answers for ONE build. image: Image of the build: a separate program, such as the application or the bootloader. Give it when the build has an image name.

Returns: list of dicts, one per call site, each with: file, line, col, caller, caller_kind, kind ("pointer": through a function pointer; "object": the operator() of a callable object; "address": a call of an address that is a number, such as a bootloader that starts the application), slot (the field, variable, parameter N of f or return of f that the call goes through; "" when the call names none), type, targets_total and targets (at most 10: {name, origin}, origin "slot" or "type_only"). An "address" row has address (the text of the address) and no target: no code of the build is there. no_slot says why a call names no slot; slot_escapes marks a slot that code out of view can write. Both reach the functions of their type: origin "type_only", a superset.

When *name* matches several symbols, a ``warning`` dict names them
and each row carries ``target_qualified_name``.

The page notice ``{total, offset, shown, more, hint}`` comes
before the rows of the answer.  ``total`` counts every row of the whole answer.  When
``more`` is true, the ``hint`` names the call that reads the next
page.  A page after the last row gives one ``info`` dict that
names the total.

Never empty: one dict with ``error`` (cannot resolve) or ``info``
(no results) replaces the results.  Check both keys first.

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": {
      "name": "<name>"
    },
    "name": "find_indirect_call_sites"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesA function pointer field or variable (the calls through it), or a function (the indirect calls it makes). E.g. 'onData'.
imageNoImage of the build: a separate program, such as the application or the bootloader. On a project of more than one build, give it when that build has an image name, as the refusal lists it.
limitNoMaximum results (default 50, max 200).
offsetNoSkip this many results. Reads the next page of a long answer.
projectNoProject name or project_id — call list_projects to get them. Use it to ask about a project that is not the project of the current directory. It is an alternative to project_root, which takes a root path. Give one of the two, not both.
variantNoVariant of the build (a board, or a PlatformIO environment). On a project of more than one build, give the arguments of one build as the refusal lists them: the variant, the image, or the two. fw-context does not select a build for you. One query answers for ONE build.
project_rootNoProject root directory. Auto-detected if omitted. This field also accepts a project name or a project_id, but project is the clear field for those.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.36.0
    • changedInput schema / properties / name / description
      Previous value: -"Name of the function pointer field or variable to find call sites of. E.g. 'onData' finds all calls through Driver::onData."New value: +"A function pointer field or variable (the calls through it), or a function (the indirect calls it makes). E.g. 'onData'."
  2. Changed4 schema fields changedv0.32.1
    • changedInput schema / properties / image / description
      Previous value: -"Sysbuild image within the variant. Required when the variant holds several: each image is a separate program."New value: +"Image of the build: a separate program, such as the application or the bootloader. On a project of more than one build, give it when that build has an image name, as the refusal lists it."
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum results (default 50)."New value: +"Maximum results (default 50, max 200)."
    • addedInput schema / properties / offset
      Added value: +{
      +  "default": 0,
      +  "description": "Skip this many results. Reads the next page of a long answer.",
      +  "minimum": 0,
      +  "title": "Offset",
      +  "type": "integer"
      +}
    • changedInput schema / properties / variant / description
      Previous value: -"Build variant (multi-build project). Omit to use default_variant. One query answers for ONE build."New value: +"Variant of the build (a board, or a PlatformIO environment). On a project of more than one build, give the arguments of one build as the refusal lists them: the variant, the image, or the two. fw-context does not select a build for you. One query answers for ONE build."
  3. Changed4 schema fields changedv0.32.0
    • changedInput schema / properties / image / description
      Previous value: -"Sysbuild image name within the variant (multi-project). Omit for all images of the variant."New value: +"Sysbuild image within the variant. Required when the variant holds several: each image is a separate program."
    • addedInput schema / properties / limit / minimum
      Added value: +1
    • addedInput schema / properties / name / minLength
      Added value: +1
    • changedInput schema / properties / variant / description
      Previous value: -"Build variant name (multi-project). Omit to use default_variant or fail-closed. Use '*' for all variants."New value: +"Build variant (multi-build project). Omit to use default_variant. One query answers for ONE build."
  4. Changed3 schema fields changedv0.30.0
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / project
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Project name or project_id — call list_projects to get them. Use it to ask about a project that is not the project of the current directory. It is an alternative to project_root, which takes a root path. Give one of the two, not both.",
      +  "title": "Project"
      +}
    • changedInput schema / properties / project_root / description
      Previous value: -"Project root directory. Auto-detected if omitted."New value: +"Project root directory. Auto-detected if omitted. This field also accepts a project name or a project_id, but project is the clear field for those."
  5. Changed2 schema fields changedv0.25.3
    • addedInput schema / properties / image
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Sysbuild image name within the variant (multi-project). Omit for all images of the variant.",
      +  "title": "Image"
      +}
    • addedInput schema / properties / variant
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Build variant name (multi-project). Omit to use default_variant or fail-closed. Use '*' for all variants.",
      +  "title": "Variant"
      +}
  6. Addedv0.8.4

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so: it declares read-only/no-side-effects, the indexing prerequisite, that one query answers for exactly one build and fw-context will not auto-select, and that a multi-symbol name yields a `warning` plus `target_qualified_name` per row. It also discloses failure semantics ('Never empty: one dict with `error` or `info` — check both keys first') and that `type_only` origins are a superset.

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

Conciseness3/5

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

It is front-loaded correctly, opening with purpose before prerequisites and arguments, but the prose is long and dense, and the multi-paragraph Returns block largely restates what the output schema already provides (field lists, paging notice shape). The 7-parameter framing plus wrapper paragraphs could be tightened without losing meaning.

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?

For a 7-parameter, build-scoped code-analysis tool, the definition covers the prerequisite index state, the multi-build refusal path, paging and continuation behavior, and the never-empty error/info contract. An agent has everything needed to call it correctly and to interpret a surprising response.

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 the baseline is 3; the description earns extra by explaining name resolution rules (qualified, bare, suffix; multi-symbol names answered individually), that a parameter is not a symbol and must be asked via its function, and that project/project_root are mutually exclusive alternatives. Most `limit`, `offset`, `variant` and `image` text merely restates the schema, so it does not rise to 5.

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 opening sentence names a specific verb (Find) and a precise resource (indirect calls through a function pointer field/variable, or indirect calls a function makes), and then defines what an indirect call is with concrete examples (`driver.onData(buf, len)`, `handlers[i](x)`, `std::function::operator()`). It explicitly separates itself from `find_callers` and `find_indirect_targets`, so an agent can choose without opening another 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?

It gives an explicit use-case question ('where is this function pointer invoked, and what does it call?') paired with the contrasting question for `find_callers` ('who calls this function?'), and routes target-discovery queries to `find_indirect_targets`. It also states a hard precondition (reference index required, refs on by default) and a constraint on build selection.

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