Skip to main content
Glama

create_post

Create LinkedIn posts with text and optional media attachments for personal profiles or company pages using the Linked API MCP server.

Instructions

Creates a new LinkedIn post with optional media attachments (st.createPost action).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesPost content, must be up to 3000 characters.
companyUrlNoLinkedIn company page URL. If specified, the post will be created on the company page (requires admin access).
attachmentsNoMedia attachments for the post. You can add up to 9 images, or 1 video, or 1 document. Cannot mix different attachment types.

Implementation Reference

  • The CreatePostTool class that implements the 'create_post' tool. It extends OperationTool, sets the tool name to 'create_post', defines the Zod input schema for validation, provides the MCP tool definition via getTool(), and uses the 'createPost' operation from LinkedAPI.
    export class CreatePostTool extends OperationTool<TCreatePostParams, unknown> { public override readonly name = 'create_post'; public override readonly operationName = OPERATION_NAME.createPost; protected override readonly schema = z.object({ text: z.string().min(1).max(3000), companyUrl: z.string().optional(), attachments: z .array( z.object({ url: z.string(), type: z.enum(['image', 'video', 'document']), name: z.string().optional(), }), ) .max(9) .optional(), }); public override getTool(): Tool { return { name: this.name, description: 'Creates a new LinkedIn post with optional media attachments (st.createPost action).', inputSchema: { type: 'object', properties: { text: { type: 'string', description: 'Post content, must be up to 3000 characters.', }, companyUrl: { type: 'string', description: 'LinkedIn company page URL. If specified, the post will be created on the company page (requires admin access).', }, attachments: { type: 'array', description: 'Media attachments for the post. You can add up to 9 images, or 1 video, or 1 document. Cannot mix different attachment types.', items: { type: 'object', properties: { url: { type: 'string', description: 'Publicly accessible URL of the media file.', }, type: { type: 'string', enum: ['image', 'video', 'document'], description: 'Type of media attachment.', }, name: { type: 'string', description: 'Display name for the document (required for documents).', }, }, required: ['url', 'type'], }, }, }, required: ['text'], }, }; } }
  • Zod schema definition for validating the input parameters of the create_post tool: text (required), companyUrl (optional), attachments (optional array).
    protected override readonly schema = z.object({ text: z.string().min(1).max(3000), companyUrl: z.string().optional(), attachments: z .array( z.object({ url: z.string(), type: z.enum(['image', 'video', 'document']), name: z.string().optional(), }), ) .max(9) .optional(), });
  • The CreatePostTool is instantiated with a progress callback and added to the array of tools in the LinkedApiTools constructor.
    new CreatePostTool(progressCallback),
  • Import of CreatePostTool from './tools/create-post.js'.
    import { CreatePostTool } from './tools/create-post.js';
  • The execute method in OperationTool base class, which performs the actual tool execution by finding the operation by operationName and calling it with progress tracking.
    export abstract class OperationTool<TParams, TResult> extends LinkedApiTool<TParams, TResult> { public abstract readonly operationName: TOperationName; public override execute({ linkedapi, args, workflowTimeout, progressToken, }: { linkedapi: LinkedApi; args: TParams; workflowTimeout: number; progressToken?: string | number; }): Promise<TMappedResponse<TResult>> { const operation = linkedapi.operations.find( (operation) => operation.operationName === this.operationName, )! as Operation<TParams, TResult>; return executeWithProgress(this.progressCallback, operation, workflowTimeout, { params: args, progressToken, }); } }

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/Linked-API/linkedapi-mcp'

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