Skip to main content
Glama

Scaffold Fragment

scaffold_fragment

Creates a new Android Fragment Kotlin file from a template, optionally generating its matching XML layout, so you can scaffold fragment classes and layouts directly inside your project module.

Instructions

Generate a new Fragment Kotlin file from a template

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": {
      "projectDir": "<projectDir>",
      "fragmentName": "<fragmentName>",
      "packageName": "<packageName>"
    },
    "name": "scaffold_fragment"
  }
}

Input Schema

NameRequiredDescriptionDefault
layoutNoGenerate a corresponding XML layout file
moduleNoModule nameapp
projectDirYesAbsolute path to the Android project root
packageNameYesPackage name
fragmentNameYesFragment class name, e.g. 'ProfileFragment'

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, destructiveHint=false and idempotentHint=false, so the safety profile is largely covered, and 'from a template' adds that files are generated rather than hand-written. However, the description never discloses the real side effects: it also creates an XML layout file (visible only via the 'layout' schema param) and it is non-idempotent without saying whether existing files are overwritten or skipped.

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?

A single front-loaded sentence with no filler or redundancy. Its brevity is efficient but edges toward under-specification rather than crispness.

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

Completeness3/5

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

With five parameters, three required, no output schema and no nested objects, the schema carries the argument burden adequately. The description is still thin for a file-generating mutation: it does not say what is created on disk, what the default layout behavior produces, or what is returned, which an agent needs to report results or handle collisions.

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 description coverage is 100%, so all five parameters (projectDir, fragmentName, packageName, module, layout) are already documented, which sets the baseline at 3. The description adds nothing about parameter meaning and leaves 'template' ambiguous — there is no parameter to choose a template, so an agent cannot tell whether the template is fixed.

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?

States a specific verb and resource ('Generate a new Fragment Kotlin file') which cleanly separates it from scaffold_activity and scaffold_compose_screen by artifact type. It stops short of naming those siblings, so differentiation relies on the agent reading the sibling list itself.

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

Usage Guidelines2/5

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

There is no when-to-use guidance at all: nothing says when to pick this over scaffold_activity or scaffold_compose_screen, nor any prerequisites such as an existing Android project or module. The agent must infer the selection context entirely from the tool name.

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