Skip to main content
Glama

pkg_expand

Read-onlyIdempotent

Retrieves exact API signatures, members, and documentation for up to five package symbols so you can write calls from the package itself instead of memory.

Instructions

Shows the exact API of up to 5 symbols of a package: constructor and overload signatures, methods, properties, enum values, documentation (XML comments, docstrings or JSDoc) and the ids of related types. The signatures are read from the package itself (NuGet: the compiled assembly; PyPI: the wheel, plus its stub package when it has no types; npm: the declaration files or the @types package), so they are the source of truth for what exists: write calls from them, not from memory. Reads only. An id that is not in the package is reported as not found while the others are still shown; more than 5 is an error. The first call for a package version downloads and indexes it. WHEN TO USE: after pkg_find gave you ids, before you write code that calls them; pass a related id back to follow a parameter or return type. To locate symbols use pkg_find, for the namespace map pkg_outline, to find a package id pkg_search.

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": {
      "packageId": "<packageId>",
      "identifiers": "<identifiers>"
    },
    "name": "pkg_expand"
  }
}

Input Schema

NameRequiredDescriptionDefault
guideNotrue: put the packages guide first in the result. Use on your first packages call, or when told it changed.
projectNoOptional, pypi and npm only: the project folder (or its pyproject.toml or package.json) inside the workspace whose lock file decides the version; default the workspace folder.
versionNoOptional: exact package version, from the project's package list or lock file. Omit for the latest stable.
sectionsNoOptional: comma separated sections. sig = signatures and constructors, methods, props, data = enum values, doc, rel = related type ids, or all. Default: a type gets sig, methods, props, doc, rel; a method gets sig, doc, rel; an enum gets data, doc. Unknown names are ignored. Ask for one section of a large type, e.g. 'methods'.
ecosystemNoOptional: 'nuget' (default), 'pypi' (a Python package) or 'npm' (a JavaScript or TypeScript package).
packageIdYesPackage id (NuGet), project name (PyPI) or package name (npm)
workspaceNoOptional, pypi and npm only: workspace name. With it, and no version, the version comes from the project's lock file (uv.lock, poetry.lock, pdm.lock, pylock.toml; package-lock.json, pnpm-lock.yaml, yarn.lock).
identifiersYesUp to 5 symbol ids from pkg_find or from a 'rel' section; a full or trailing type name ('Polly.ResiliencePipeline' or 'ResiliencePipeline') also works.
targetFrameworkNoOptional, NuGet only: target framework such as 'net10.0' (default: the configured default)
includePrereleaseNoOptional: allow prerelease when no version is given (default false; NuGet only)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.2.2
    • changedInput schema / properties / identifiers / description
      Previous value: -"Symbol ids from pkg_find or related ids (max 5); a full or trailing type name also works"New value: +"Up to 5 symbol ids from pkg_find or from a 'rel' section; a full or trailing type name ('Polly.ResiliencePipeline' or 'ResiliencePipeline') also works."
    • changedInput schema / properties / sections / description
      Previous value: -"Optional: comma separated sections - sig, methods, props, data, doc, rel, or all"New value: +"Optional: comma separated sections. sig = signatures and constructors, methods, props, data = enum values, doc, rel = related type ids, or all. Default: a type gets sig, methods, props, doc, rel; a method gets sig, doc, rel; an enum gets data, doc. Unknown names are ignored. Ask for one section of a large type, e.g. 'methods'."
  2. First observedv0.2.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, it discloses partial-failure semantics (an unknown id is reported as not found while the others are still shown), a hard error condition (more than 5 ids), and a first-call cost ('downloads and indexes it'). It also tells the agent the data provenance — compiled assembly, wheel/stub, or declaration files/@types — which is what justifies trusting the signatures over memory.

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 verb and returned content, then behavior, then routing guidance — a sensible order. It is dense but mostly earns its space; the ecosystem-detail parenthetical about NuGet/PyPI/npm sources is the longest stretch and could be trimmed without losing decision value.

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 10-parameter read tool with no output schema, the description still conveys what a result contains (signatures, docs, related ids), how failures are surfaced, and the first-call latency. Version and project resolution are fully documented in the schema, so nothing needed for correct invocation is missing.

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, but the description adds meaning the schema does not: identifiers may be related-type ids from a returned 'rel' section, and the over-5 rule plus not-found behavior define how the identifiers array behaves. It does not add anything for the version/workspace/framework resolution parameters, leaving those 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?

States a specific verb and resource: 'Shows the exact API of up to 5 symbols of a package', then enumerates exactly what is returned (constructor/overload signatures, methods, properties, enum values, docs, related ids). It is clearly distinguishable from siblings by explicitly assigning symbol location to pkg_find, namespace mapping to pkg_outline, and package lookup to pkg_search.

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 'WHEN TO USE' block gives an explicit trigger (after pkg_find returned ids, before writing code that calls them) plus a follow-up pattern (pass a related id back to follow a parameter or return type). It also names each alternative tool with the job it owns, covering both when to use and when not to.

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