Skip to main content
Glama

createSignedUploadUrl

Generate secure URLs for client-side file uploads to Pinata IPFS while protecting API keys, with options to control expiration, file size, and allowed types.

Instructions

Create a signed URL for client-side file uploads without exposing your API key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expiresYesHow long the URL is valid in seconds after signing
max_file_sizeNoRestrict the max size of a file upload in bytes
allow_mime_typesNoArray of allowed MIME types (supports wildcards like 'image/*')
group_idNoID of the group that the file will be uploaded to
filenameNoName of the file that will be uploaded
keyvaluesNoMetadata key-value pairs for the file

Implementation Reference

  • Handler implementation for createSignedUploadUrl tool - makes a POST request to Pinata's upload signing endpoint to generate a time-limited signed URL for secure client-side file uploads
      async ({ expires, max_file_size, allow_mime_types, group_id, filename, keyvalues }) => {
        try {
          const url = "https://uploads.pinata.cloud/v3/files/sign";
          const date = Math.floor(Date.now() / 1000);
    
          const payload: {
            date: number;
            expires: number;
            max_file_size?: number;
            allow_mime_types?: string[];
            group_id?: string;
            filename?: string;
            keyvalues?: Record<string, string>;
          } = { date, expires };
    
          if (max_file_size) payload.max_file_size = max_file_size;
          if (allow_mime_types) payload.allow_mime_types = allow_mime_types;
          if (group_id) payload.group_id = group_id;
          if (filename) payload.filename = filename;
          if (keyvalues) payload.keyvalues = keyvalues;
    
          const response = await fetch(url, {
            method: "POST",
            headers: getHeaders(),
            body: JSON.stringify(payload),
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            throw new Error(
              `Failed to create signed upload URL: ${response.status} ${response.statusText}\n${errorText}`
            );
          }
    
          const data = await response.json();
          return {
            content: [
              {
                type: "text",
                text: `✅ Signed upload URL created!\n\nURL: ${data.data}\n\nExpires in ${expires} seconds`,
              },
            ],
          };
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
  • Zod schema defining input parameters for createSignedUploadUrl tool - validates expires (required), and optional max_file_size, allow_mime_types, group_id, filename, and keyvalues parameters
    {
      expires: z
        .number()
        .describe("How long the URL is valid in seconds after signing"),
      max_file_size: z
        .number()
        .optional()
        .describe("Restrict the max size of a file upload in bytes"),
      allow_mime_types: z
        .array(z.string())
        .optional()
        .describe("Array of allowed MIME types (supports wildcards like 'image/*')"),
      group_id: z
        .string()
        .optional()
        .describe("ID of the group that the file will be uploaded to"),
      filename: z
        .string()
        .optional()
        .describe("Name of the file that will be uploaded"),
      keyvalues: z
        .record(z.string())
        .optional()
        .describe("Metadata key-value pairs for the file"),
    },
  • src/index.ts:1474-1549 (registration)
    Tool registration for createSignedUploadUrl - registers the MCP tool with its name, description, input schema, and handler function
    server.tool(
      "createSignedUploadUrl",
      "Create a signed URL for client-side file uploads without exposing your API key",
      {
        expires: z
          .number()
          .describe("How long the URL is valid in seconds after signing"),
        max_file_size: z
          .number()
          .optional()
          .describe("Restrict the max size of a file upload in bytes"),
        allow_mime_types: z
          .array(z.string())
          .optional()
          .describe("Array of allowed MIME types (supports wildcards like 'image/*')"),
        group_id: z
          .string()
          .optional()
          .describe("ID of the group that the file will be uploaded to"),
        filename: z
          .string()
          .optional()
          .describe("Name of the file that will be uploaded"),
        keyvalues: z
          .record(z.string())
          .optional()
          .describe("Metadata key-value pairs for the file"),
      },
      async ({ expires, max_file_size, allow_mime_types, group_id, filename, keyvalues }) => {
        try {
          const url = "https://uploads.pinata.cloud/v3/files/sign";
          const date = Math.floor(Date.now() / 1000);
    
          const payload: {
            date: number;
            expires: number;
            max_file_size?: number;
            allow_mime_types?: string[];
            group_id?: string;
            filename?: string;
            keyvalues?: Record<string, string>;
          } = { date, expires };
    
          if (max_file_size) payload.max_file_size = max_file_size;
          if (allow_mime_types) payload.allow_mime_types = allow_mime_types;
          if (group_id) payload.group_id = group_id;
          if (filename) payload.filename = filename;
          if (keyvalues) payload.keyvalues = keyvalues;
    
          const response = await fetch(url, {
            method: "POST",
            headers: getHeaders(),
            body: JSON.stringify(payload),
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            throw new Error(
              `Failed to create signed upload URL: ${response.status} ${response.statusText}\n${errorText}`
            );
          }
    
          const data = await response.json();
          return {
            content: [
              {
                type: "text",
                text: `✅ Signed upload URL created!\n\nURL: ${data.data}\n\nExpires in ${expires} seconds`,
              },
            ],
          };
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the security benefit ('without exposing your API key') but lacks critical details: whether this is a read-only or mutating operation, authentication requirements, rate limits, error conditions, or what the signed URL enables (e.g., direct upload to storage). For a tool that likely involves sensitive operations, this is inadequate.

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 a single, efficient sentence that states the core purpose and key benefit. It's front-loaded with essential information and contains no redundant or verbose language. Every word earns its place.

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

Completeness2/5

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

Given the tool's complexity (6 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain what the tool returns (e.g., a URL string, an object with metadata), how to use the signed URL, or potential side effects. For a security-sensitive tool that generates upload URLs, more context is needed for safe and effective use.

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 parameters are documented in the schema. The description adds no additional parameter semantics beyond implying the URL is for 'client-side file uploads', which is already suggested by the tool name. This meets the baseline for high schema coverage but doesn't enhance understanding of individual parameters.

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 clearly states the tool's purpose: 'Create a signed URL for client-side file uploads without exposing your API key'. It specifies the verb ('Create'), resource ('signed URL'), and key benefit ('without exposing your API key'). However, it doesn't explicitly differentiate from sibling tools like 'uploadFile' or 'createPrivateDownloadLink', which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'uploadFile' (server-side upload) or 'createPrivateDownloadLink' (download URLs), nor does it specify prerequisites or appropriate contexts. The agent must infer usage from the purpose alone.

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/PinataCloud/pinata-mcp'

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