Skip to main content
Glama
prismism-dev

Prismism MCP Server

by prismism-dev

Publish File to Prismism

prismism_publish

Upload files to generate shareable, tracked links for PDFs, HTML, Markdown, images, and videos. Send content as plain text or base64-encoded for binary files.

Instructions

Upload a file and get a shareable, tracked link. Supports PDF, HTML, Markdown, images (PNG/JPG/GIF/SVG/WebP), and video (MP4). Send content as plain text (default) or base64 for binary files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesFile content — plain text (default) or base64-encoded for binary files
filenameYesFilename with extension, e.g. "report.pdf" or "chart.png"
encodingNoContent encoding — use "base64" for binary files like PDFs, images, or videoutf8
contentTypeNoMIME type — auto-detected from filename if not provided
titleNoDisplay title for the artifact

Implementation Reference

  • The handler function for the 'prismism_publish' tool, which manages file uploading, content type resolution, and optional title updates for artifacts.
    async ({ content, filename, encoding, contentType, title }) => {
      if (!hasApiKey()) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                ok: false,
                error: { code: 'NO_API_KEY', message: 'API key required to publish' },
                _hints: ['Set PRISMISM_API_KEY in your MCP config. Use prismism_register to create an account.'],
              }),
            },
          ],
          isError: true,
        };
      }
    
      // Convert content to Buffer
      const buffer = encoding === 'base64' ? Buffer.from(content, 'base64') : Buffer.from(content, 'utf-8');
    
      const resolvedContentType = contentType || inferContentType(filename);
    
      const result = await upload<{
        id: string;
        shortId: string;
        title: string;
        url: string;
        filename: string;
        mimeType: string;
        size: number;
        allowDownload: boolean;
        createdAt: string;
      }>('/v1/artifacts', buffer, filename, resolvedContentType);
    
      if (!result.ok) {
        return {
          content: [{ type: 'text', text: JSON.stringify(result) }],
          isError: true,
        };
      }
    
      // If a title was provided, update the artifact
      if (title && result.data?.id) {
        await patch(`/v1/artifacts/${result.data.id}`, { title });
        if (result.data) {
          result.data.title = title;
        }
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              ok: true,
              data: result.data,
              _hints: result.data?.url ? [`Shareable link: ${result.data.url}`] : undefined,
            }),
          },
        ],
      };
    }
  • The input schema defining the parameters for the 'prismism_publish' tool.
    inputSchema: {
      content: z.string().describe('File content — plain text (default) or base64-encoded for binary files'),
      filename: z.string().describe('Filename with extension, e.g. "report.pdf" or "chart.png"'),
      encoding: z.enum(['utf8', 'base64']).default('utf8').describe('Content encoding — use "base64" for binary files like PDFs, images, or video'),
      contentType: z.string().optional().describe('MIME type — auto-detected from filename if not provided'),
      title: z.string().optional().describe('Display title for the artifact'),
    },
  • The registration function that defines the 'prismism_publish' tool on the MCP server instance.
    export function registerPublishTool(server: McpServer) {
      server.registerTool(
        'prismism_publish',
        {
          title: 'Publish File to Prismism',
          description:
            'Upload a file and get a shareable, tracked link. Supports PDF, HTML, Markdown, images (PNG/JPG/GIF/SVG/WebP), and video (MP4). Send content as plain text (default) or base64 for binary files.',
          inputSchema: {
            content: z.string().describe('File content — plain text (default) or base64-encoded for binary files'),
            filename: z.string().describe('Filename with extension, e.g. "report.pdf" or "chart.png"'),
            encoding: z.enum(['utf8', 'base64']).default('utf8').describe('Content encoding — use "base64" for binary files like PDFs, images, or video'),
            contentType: z.string().optional().describe('MIME type — auto-detected from filename if not provided'),
            title: z.string().optional().describe('Display title for the artifact'),
          },
        },
        async ({ content, filename, encoding, contentType, title }) => {
          if (!hasApiKey()) {
            return {
              content: [
                {
                  type: 'text',
                  text: JSON.stringify({
                    ok: false,
                    error: { code: 'NO_API_KEY', message: 'API key required to publish' },
                    _hints: ['Set PRISMISM_API_KEY in your MCP config. Use prismism_register to create an account.'],
                  }),
                },
              ],
              isError: true,
            };
          }
    
          // Convert content to Buffer
          const buffer = encoding === 'base64' ? Buffer.from(content, 'base64') : Buffer.from(content, 'utf-8');
    
          const resolvedContentType = contentType || inferContentType(filename);
    
          const result = await upload<{
            id: string;
            shortId: string;
            title: string;
            url: string;
            filename: string;
            mimeType: string;
            size: number;
            allowDownload: boolean;
            createdAt: string;
          }>('/v1/artifacts', buffer, filename, resolvedContentType);
    
          if (!result.ok) {
            return {
              content: [{ type: 'text', text: JSON.stringify(result) }],
              isError: true,
            };
          }
    
          // If a title was provided, update the artifact
          if (title && result.data?.id) {
            await patch(`/v1/artifacts/${result.data.id}`, { title });
            if (result.data) {
              result.data.title = title;
            }
          }
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  ok: true,
                  data: result.data,
                  _hints: result.data?.url ? [`Shareable link: ${result.data.url}`] : undefined,
                }),
              },
            ],
          };
        }
      );
    }
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses that links are 'tracked' and 'shareable', indicating monitoring and accessibility traits. However, it omits critical operational details like file size limits, retention policies, idempotency behavior, or rate limits.

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?

Two sentences with zero waste. First sentence front-loads the action and supported formats; second sentence handles encoding guidance. Every word earns its place.

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 no output schema, the description adequately indicates the return value ('get a shareable... link'). With 100% parameter coverage in schema, the description appropriately focuses on format support and encoding. Minor gap: missing operational constraints like file size limits.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage, baseline is 3. The description adds value by listing supported file formats (PDF, HTML, Markdown, etc.) and explaining the binary vs text encoding decision logic, which aids parameter selection beyond raw schema definitions.

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?

Description states specific verb ('Upload') + resource ('file') + outcome ('shareable, tracked link'). The action clearly distinguishes it from siblings like prismism_get, prismism_update, and prismism_delete.

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

Usage Guidelines4/5

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

Provides clear guidance on when to use base64 vs plain text encoding for binary files. However, it does not explicitly differentiate from prismism_update (for existing files) or mention prerequisites like authentication.

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/prismism-dev/mcp-server'

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