Skip to main content
Glama
io.github.KoyoYeager/pystub

io.github.KoyoYeager/pystub

by KoyoYeager

generate_submodule

Generates submodule stubs to indirectly exclude C extension packages during Python executable builds and returns backup, apply, restore, and validation steps.

Instructions

C拡張パッケージを間接排除するためのサブモジュールスタブを生成します。

PySide6 のような C拡張パッケージは直接スタブ化できませんが、 そのパッケージを import しているサブモジュール(例: asammdf.gui)を スタブ化することで間接的に排除できます。

analyze ツールの結果に含まれる submodule_stub_hints の情報を元に このツールを使用してください。

復元失敗を防ぐため、バックアップ・バージョン固定・検証ステップを 含むビルド手順を生成します(バージョン固定は配布物の情報(dist-info の版)がある時だけで、無い時は版なしになります)。

Args: entry_point: プロジェクトのエントリーポイントファイルパス parent_package: サブモジュールが属するパッケージ名(例: "asammdf") submodule: スタブ化するサブモジュール(例: "asammdf.gui") python_path: site-packages パス(空の場合は現在の環境を自動検出)

Returns: files: {相対パス: コード内容} の辞書 eliminated_packages: 排除されるパッケージ一覧 build_instructions: バックアップ・適用・復元・検証の手順

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": {
      "entry_point": "<entry_point>",
      "parent_package": "<parent_package>",
      "submodule": "<submodule>"
    },
    "name": "generate_submodule"
  }
}

Input Schema

NameRequiredDescriptionDefault
submoduleYes
entry_pointYes
python_pathNo
parent_packageYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and largely meets it: it discloses that the output includes backup, apply, restore, and verification steps for build instructions, and that version pinning is applied only when dist-info version data exists. It also makes clear that files are returned as a {relative path: code} dict rather than describing on-disk mutation. It does not state whether anything is written to the project or what happens if the submodule is already stubbed.

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?

The purpose is front-loaded in the first sentence, followed by the motivating explanation, a pointer to the prerequisite tool, caveats, and then an Args/Returns block. The PySide6 example adds real value rather than filler, though the prose is somewhat longer than strictly necessary.

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 four-parameter generation tool with no annotations and no output schema, the description covers purpose, prerequisite inputs, all parameters, and the keys of the returned mapping. Remaining gaps are edge-case behavior (existing stubs, write side effects) rather than anything needed to invoke it correctly.

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 0%, so the description must compensate, and it does: an Args block names all four parameters, gives the meaning of each, supplies concrete examples for parent_package ('asammdf') and submodule ('asammdf.gui'), and explains that an empty python_path triggers auto-detection of the current environment. Format details for paths (absolute vs relative) are still unspecified.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: generating submodule stubs that indirectly eliminate C-extension packages, with a worked example (PySide6 → asammdf.gui). It clearly explains the mechanism, so an agent understands what the tool produces. It does not explicitly contrast itself with the sibling 'generate' tool, which keeps it from a 5.

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 description explicitly tells the agent when to use the tool, namely when the 'analyze' tool's results contain submodule_stub_hints, and points to that tool as the source of the required inputs. It gives no explicit when-not conditions or guidance for choosing between this tool and the sibling 'generate'.

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

Deploy Server

Other Tools