Skip to main content
Glama

scaffold_route_handler

Generate a complete Next.js App Router upload route handler file for UploadKit, enabling server-side file uploads with configurable size limits and accepted file types.

Instructions

Generate the complete file content for a Next.js App Router upload route handler — typed file router, handler export, correct path comment.

When to use: when the user is setting up UploadKit server-side in a Next.js App Router project and needs the app/api/uploadkit/[...uploadkit]/route.ts file created. The returned string is a complete, compilable TypeScript file — write it to disk as-is.

Returns: a markdown-formatted string containing the target path and the complete TS source inside a fenced code block. You must create the file at the literal path app/api/uploadkit/[...uploadkit]/route.ts. Read-only — generates text, never touches the filesystem itself.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
routeNameYesThe key for this file route in the `FileRouter` object. This exact string is what consumers pass as the `route` prop on components (e.g. `<UploadDropzone route="media" />`). Use a short lowercase identifier matching the file-category — examples: "media" for a general images+videos endpoint, "avatar" for user profile pictures, "attachments" for message/ticket attachments, "documents" for PDFs.
maxFileSizeNoMaximum allowed size per uploaded file, expressed with a unit suffix. Examples: "4MB" (default), "512KB", "1GB", "100MB". Omit to use the default of "4MB". Rejects uploads larger than this value with a 413 response.
allowedTypesNoMIME types (or wildcard patterns) that this route accepts. Examples: ["image/*"] (default — any image), ["image/jpeg", "image/png"] (two specific types), ["application/pdf"] (PDF only), ["image/*", "video/mp4"] (images plus MP4). Omit for the default of ["image/*"]. Rejects mismatched uploads with a 415 response.
maxFileCountNoMaximum number of files per single upload request. Default: 1. Set to a larger number to enable multi-file drag-and-drop (e.g. 10 for gallery uploaders). Must be >= 1.
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: 'Read-only — generates text, never touches the filesystem itself' clarifies it's a generation-only tool, 'Returns: a markdown-formatted string' specifies output format, and 'write it to disk as-is' provides implementation guidance. It doesn't mention error conditions or performance characteristics, but covers the essential safety profile.

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

Conciseness5/5

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

Perfectly structured with purpose statement, usage context, return specification, and implementation instruction in four clear sentences. Every sentence earns its place by providing essential information without redundancy. The description is appropriately sized and front-loaded with the core functionality.

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 code generation tool with no output schema, the description provides excellent context: specifies the exact file path, output format (markdown with fenced code block), and that it's compilable TypeScript. It could mention error handling or validation behavior, but covers the essential context for proper tool invocation given the complexity.

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 the schema already fully documents all 4 parameters. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score of 3. However, it does provide context about how these parameters relate to the generated route handler.

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 specific action ('Generate the complete file content for a Next.js App Router upload route handler') and resource ('typed file router, handler export, correct path comment'). It distinguishes itself from sibling tools like 'scaffold_provider' by focusing specifically on route handler generation for UploadKit integration.

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?

Explicitly states 'When to use: when the user is setting up UploadKit server-side in a Next.js App Router project and needs the `app/api/uploadkit/[...uploadkit]/route.ts` file created.' This provides clear context about when this tool should be selected over alternatives, including the specific file path requirement.

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/drumst0ck/uploadkit'

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