Skip to main content
Glama
appolabs

Appo MCP

Official
by appolabs

scaffold_feature

Scaffold a complete feature integration for mobile-web APIs, generating hook, component, and types files with integration instructions.

Instructions

Scaffold complete feature integration including hook, component, and types. Returns multiple files with integration instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featureYesThe SDK feature to scaffold
directoryNoTarget directory path for file suggestions
includeTestsNoInclude test file scaffolding (default: true)

Implementation Reference

  • Tool registration with name 'scaffold_feature', description, and inputSchema (feature, directory, includeTests). feature is required and must be one of SDK_FEATURES.
    {
      name: "scaffold_feature",
      description:
        "Scaffold complete feature integration including hook, component, and types. Returns multiple files with integration instructions.",
      inputSchema: {
        type: "object",
        properties: {
          feature: {
            type: "string",
            enum: SDK_FEATURES,
            description: "The SDK feature to scaffold",
          },
          directory: {
            type: "string",
            description: "Target directory path for file suggestions",
          },
          includeTests: {
            type: "boolean",
            description: "Include test file scaffolding (default: true)",
          },
        },
        required: ["feature"],
      },
    },
  • Main scaffoldFeature handler function. Validates the feature, generates scaffold files (types, hook, component, optional tests), and returns a markdown-formatted response with file contents and integration instructions.
    export async function scaffoldFeature(
      args: Record<string, unknown>
    ): Promise<{ content: Array<{ type: "text"; text: string }> }> {
      const {
        feature,
        directory = "src",
        includeTests = true,
      } = args as unknown as ScaffoldFeatureArgs;
    
      if (!feature || !featureDescriptions[feature]) {
        return {
          content: [
            {
              type: "text",
              text: `Invalid feature. Available features:\n${Object.entries(featureDescriptions)
                .map(([key, desc]) => `- ${key}: ${desc}`)
                .join("\n")}`,
            },
          ],
        };
      }
    
      const capitalizedFeature = feature.charAt(0).toUpperCase() + feature.slice(1);
      const hookName = `use${capitalizedFeature}`;
      const componentName = `${capitalizedFeature}Component`;
      const requiresPermission = permissionFeatures.includes(feature as typeof permissionFeatures[number]);
    
      const files = generateScaffoldFiles(feature, capitalizedFeature, hookName, componentName, directory, includeTests, requiresPermission);
    
      return {
        content: [
          {
            type: "text",
            text: `# ${capitalizedFeature} Feature Scaffold
    
    ${featureDescriptions[feature]}
    
    ## Files to Create
    
    ${files.map((f) => `### ${f.path}\n\`\`\`${f.language}\n${f.content}\n\`\`\``).join("\n\n")}
    
    ## Integration Steps
    
    1. **Install the SDK** (if not already installed):
       \`\`\`bash
       npm install @appolabs/appo
       # or
       pnpm add @appolabs/appo
       \`\`\`
    
    2. **Create the files** listed above in your project
    
    3. **Import and use** in your app:
       \`\`\`tsx
       import { ${componentName} } from './${directory}/components/${feature}';
    
       function App() {
         return <${componentName} />;
       }
       \`\`\`
    
    ${requiresPermission ? `## Permission Handling
    
    This feature requires user permission. The scaffold includes:
    - Permission request on first interaction
    - Graceful handling of denied permissions
    - Loading states during permission checks
    
    **Important:** Always explain to users WHY you need this permission before requesting it.` : ""}
    
    ## Native vs Web Behavior
    
    The SDK provides automatic fallbacks for web browsers:
    ${getNativeFallbackInfo(feature)}`,
          },
        ],
      };
    }
  • TypeScript interface ScaffoldFeatureArgs defining input: feature (SdkFeature), directory (optional string), includeTests (optional boolean).
    interface ScaffoldFeatureArgs {
      feature: SdkFeature;
      directory?: string;
      includeTests?: boolean;
    }
  • Helper function getNativeFallbackInfo returning web fallback descriptions per feature.
    function getNativeFallbackInfo(feature: SdkFeature): string {
      const fallbacks: Record<SdkFeature, string> = {
        push: "- Web: Returns 'denied' permission, null token",
        biometrics: "- Web: Returns false for availability",
        camera: "- Web: Returns 'denied' permission",
        location: "- Web: Returns 'denied' permission (consider using browser Geolocation API)",
        haptics: "- Web: Silent no-op (no vibration API used)",
        storage: "- Web: Falls back to localStorage",
        share: "- Web: Uses navigator.share() if available, otherwise fails gracefully",
        network: "- Web: Uses navigator.onLine and online/offline events",
        device: "- Web: Parses user agent for basic device info",
      };
    
      return fallbacks[feature];
    }
  • Helper function generateScaffoldFiles that creates the list of files (types, hook, component, optional test). Delegates to specific generators.
    function generateScaffoldFiles(
      feature: SdkFeature,
      _capitalizedFeature: string,
      hookName: string,
      componentName: string,
      directory: string,
      includeTests: boolean,
      _requiresPermission: boolean
    ): Array<{ path: string; language: string; content: string }> {
      const files: Array<{ path: string; language: string; content: string }> = [];
    
      // Types file
      files.push({
        path: `${directory}/types/${feature}.ts`,
        language: "typescript",
        content: generateTypesFile(feature),
      });
    
      // Hook file
      files.push({
        path: `${directory}/hooks/${hookName}.ts`,
        language: "typescript",
        content: generateHookFile(feature, hookName, _requiresPermission),
      });
    
      // Component file
      files.push({
        path: `${directory}/components/${componentName}.tsx`,
        language: "tsx",
        content: generateComponentFile(feature, componentName, hookName),
      });
    
      // Test file
      if (includeTests) {
        files.push({
          path: `${directory}/__tests__/${hookName}.test.ts`,
          language: "typescript",
          content: generateTestFile(feature, hookName),
        });
      }
    
      return files;
    }
Behavior2/5

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

With no annotations, the description must convey behavioral traits. It mentions returning multiple files with instructions, but does not disclose potential side effects like file creation or overwriting, or any authentication requirements.

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 description is concise with two sentences, each serving a purpose: stating the action and the outcome. No wasted words, though it could be slightly more structured.

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?

Given the tool's three parameters and lack of output schema or annotations, the description covers the main functionality but omits details like the includeTests parameter and the exact nature of returned files. Adequate but not thorough.

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 coverage is 100%, and the description does not add meaningful detail beyond the parameter descriptions. Baseline score of 3 is appropriate as the description adds little to parameter understanding.

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 description clearly states the tool's purpose: to scaffold a complete feature integration including hook, component, and types. This distinguishes it from sibling tools like generate_component and generate_hook which handle individual parts.

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

Usage Guidelines3/5

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

The description implies usage for full feature scaffolding but does not explicitly state when to use this tool versus alternatives. No guidance on prerequisites or conditions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/appolabs/appo-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server