Skip to main content
Glama

Upload File with Expiry

rustypaste_upload_file_with_expiry

Upload files with automatic deletion after a set expiry time. Share files temporarily by specifying duration like '1h' or '7d' before they are removed from the server.

Instructions

Upload a local file to rustypaste with an expiration time.

The file will be available at the returned URL until the expiry time elapses, after which it is automatically deleted from the server.

Args:

  • file_path (string): Absolute path to the file (e.g. "/home/user/doc.pdf")

  • expiry (string): How long the file should be available (e.g. "10min", "1h", "1d", "1w")

Returns: The URL of the uploaded file.

Examples:

  • Upload for 1 hour: file_path="/tmp/log.txt", expiry="1h"

  • Upload for 7 days: file_path="/home/user/img.png", expiry="7d"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to the file to upload
expiryYesExpiry duration string (e.g. '10min', '1h', '1d', '1w'). Supported units: s/sec, min, h/hour, d/day, w/week, M/month

Implementation Reference

  • Handler implementation for the rustypaste_upload_file_with_expiry tool.
    async (params: Input) => {
        try {
            const client = new RustypasteClient();
            const result = await client.uploadFileWithExpiry(
                params.file_path,
                params.expiry
            );
            return {
                content: [
                    {
                        type: "text" as const,
                        text: `✅ File uploaded with expiry (${params.expiry})!\n\nURL: ${result.url}`,
                    },
                ],
            };
        } catch (error) {
            return {
                isError: true,
                content: [
                    {
                        type: "text" as const,
                        text: `Error: ${error instanceof Error ? error.message : String(error)}`,
                    },
                ],
            };
        }
    }
  • Input schema for the rustypaste_upload_file_with_expiry tool.
    const InputSchema = z.object({
        file_path: z
            .string()
            .min(1, "File path must not be empty")
            .describe("Absolute path to the file to upload"),
        expiry: z
            .string()
            .min(1, "Expiry must not be empty")
            .describe(
                "Expiry duration string (e.g. '10min', '1h', '1d', '1w'). " +
                "Supported units: s/sec, min, h/hour, d/day, w/week, M/month"
            ),
    });
  • Registration function for the rustypaste_upload_file_with_expiry tool.
    export function registerUploadFileWithExpiry(server: McpServer): void {
        server.registerTool(
            "rustypaste_upload_file_with_expiry",
            {
                title: "Upload File with Expiry",
                description: `Upload a local file to rustypaste with an expiration time.
    
    The file will be available at the returned URL until the expiry time elapses,
    after which it is automatically deleted from the server.
    
    Args:
      - file_path (string): Absolute path to the file (e.g. "/home/user/doc.pdf")
      - expiry (string): How long the file should be available (e.g. "10min", "1h", "1d", "1w")
    
    Returns:
      The URL of the uploaded file.
    
    Examples:
      - Upload for 1 hour: file_path="/tmp/log.txt", expiry="1h"
      - Upload for 7 days: file_path="/home/user/img.png", expiry="7d"`,
                inputSchema: InputSchema,
                annotations: {
                    readOnlyHint: false,
                    destructiveHint: false,
                    idempotentHint: false,
                    openWorldHint: true,
                },
            },
            async (params: Input) => {
                try {
                    const client = new RustypasteClient();
                    const result = await client.uploadFileWithExpiry(
                        params.file_path,
                        params.expiry
                    );
                    return {
                        content: [
                            {
                                type: "text" as const,
                                text: `✅ File uploaded with expiry (${params.expiry})!\n\nURL: ${result.url}`,
                            },
                        ],
                    };
                } catch (error) {
                    return {
                        isError: true,
                        content: [
                            {
                                type: "text" as const,
                                text: `Error: ${error instanceof Error ? error.message : String(error)}`,
                            },
                        ],
                    };
                }
            }
        );
    }
Behavior4/5

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

The description adds valuable behavioral context beyond annotations: it explains that the file is automatically deleted after expiry, which is a key trait not covered by annotations (which only indicate it's not read-only, not open-world, not idempotent, and not destructive). This disclosure of server-side cleanup behavior is crucial for understanding tool effects. No contradiction with annotations.

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?

The description is well-structured and front-loaded: the first sentence states the core purpose, followed by key behavioral details, then organized sections for Args, Returns, and Examples. Every sentence adds value without redundancy, making it efficient and easy to parse.

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?

Given the tool's moderate complexity (2 parameters, no output schema, annotations present), the description is largely complete: it covers purpose, usage, behavior, parameters, and examples. However, it lacks details on error handling or response format beyond the URL, which could be useful for an agent. The annotations help but don't fully compensate for missing output schema.

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?

With 100% schema description coverage, the schema already fully documents both parameters (file_path and expiry). The description adds minimal extra semantics (e.g., examples like '10min', '1h'), but doesn't provide significant new meaning beyond the schema's detailed descriptions. This meets the baseline for high schema coverage.

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 ('upload a local file') with the distinctive feature ('with an expiration time'), differentiating it from sibling tools like 'rustypaste_upload_file' (which presumably lacks expiry) and 'rustypaste_oneshot_file' (which may have different behavior). It explicitly mentions the resource ('rustypaste') and outcome ('available at the returned URL').

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 description provides explicit usage guidance by stating when to use this tool (for uploading with expiry) and implicitly when not to use it (e.g., for non-expiring uploads, use 'rustypaste_upload_file'). It distinguishes from siblings by highlighting the unique expiry feature, though it doesn't name alternatives directly, the context is clear.

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/rukh-debug/rustypaste-mcp'

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