Skip to main content
Glama

send_linkedin_post

Create and publish LinkedIn posts using your connected account. Specify text content, visibility settings, and comment permissions to share professional updates.

Instructions

Create a post on LinkedIn. Account ID is taken from environment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
comment_scopeNoWho can comment on the postALL
textYesPost text content
timeoutNoTimeout in seconds
visibilityNoPost visibilityANYONE

Implementation Reference

  • Handler function that prepares request data including account_id and posts to the LinkedIn management post endpoint via makeRequest, returns JSON response or error.
    async ({ text, visibility, comment_scope, timeout }) => {
      const requestData = { text, visibility, comment_scope, timeout, account_id: ACCOUNT_ID };
      log("Creating LinkedIn post with text:", text.substring(0, 50) + (text.length > 50 ? "..." : ""));
      try {
        const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_POST, requestData);
        return {
          content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
        };
      } catch (error) {
        log("LinkedIn post creation error:", error);
        return {
          content: [{ type: "text", text: `LinkedIn post creation API error: ${formatError(error)}` }],
          isError: true
        };
      }
    }
  • src/index.ts:972-997 (registration)
    MCP server tool registration for 'send_linkedin_post' with description, Zod input schema, and inline handler function.
    server.tool(
      "send_linkedin_post",
      "Create LinkedIn post (requires ACCOUNT_ID)",
      {
        text: z.string().describe("Post text"),
        visibility: z.string().default("ANYONE").describe("Post visibility"),
        comment_scope: z.string().default("ALL").describe("Comment scope"),
        timeout: z.number().default(300).describe("Timeout in seconds")
      },
      async ({ text, visibility, comment_scope, timeout }) => {
        const requestData = { text, visibility, comment_scope, timeout, account_id: ACCOUNT_ID };
        log("Creating LinkedIn post with text:", text.substring(0, 50) + (text.length > 50 ? "..." : ""));
        try {
          const response = await makeRequest(API_CONFIG.ENDPOINTS.LINKEDIN_POST, requestData);
          return {
            content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
          };
        } catch (error) {
          log("LinkedIn post creation error:", error);
          return {
            content: [{ type: "text", text: `LinkedIn post creation API error: ${formatError(error)}` }],
            isError: true
          };
        }
      }
    );
  • TypeScript interface defining input arguments for send_linkedin_post tool, matching the Zod schema.
    export interface SendLinkedinPostArgs {
      text: string;
      visibility?: "ANYONE" | "CONNECTIONS_ONLY";
      comment_scope?: "ALL" | "CONNECTIONS_ONLY" | "NONE";
      timeout?: number;
    }
  • Type guard function to validate input arguments conform to SendLinkedinPostArgs interface.
    export function isValidSendLinkedinPostArgs(
      args: unknown
    ): args is SendLinkedinPostArgs {
      if (typeof args !== "object" || args === null) return false;
      const obj = args as Record<string, unknown>;
    
      if (typeof obj.text !== "string" || !obj.text.trim()) return false;
    
      if (obj.visibility !== undefined &&
          obj.visibility !== "ANYONE" &&
          obj.visibility !== "CONNECTIONS_ONLY") return false;
    
      if (obj.comment_scope !== undefined &&
          obj.comment_scope !== "ALL" &&
          obj.comment_scope !== "CONNECTIONS_ONLY" &&
          obj.comment_scope !== "NONE") return false;
    
      if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
    
      return true;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'Account ID is taken from environment,' which adds some authentication context, but fails to cover critical traits like whether this is a destructive write operation, potential rate limits, error handling, or what happens on success (e.g., returns a post ID). For a mutation tool with zero annotation coverage, 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 extremely concise with just two short sentences that are front-loaded with the core purpose. Every word serves a purpose, with no wasted text or 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.

Completeness2/5

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

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks information on behavioral traits (e.g., side effects, error cases), return values, and differentiation from sibling tools. The minimal content doesn't compensate for the missing structured data.

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 fully documents all parameters (text, comment_scope, visibility, timeout). The description adds no parameter-specific information beyond what's in the schema, such as examples or constraints. Baseline 3 is appropriate when the schema does all the work.

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 action ('Create a post') and target resource ('on LinkedIn'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'send_linkedin_chat_message' or 'send_linkedin_post_comment', which are also LinkedIn posting tools but for different content types.

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 minimal guidance with 'Account ID is taken from environment,' which hints at authentication context but doesn't explain when to use this tool versus alternatives. No explicit when/when-not instructions or comparisons to sibling posting tools (e.g., chat messages, comments) are included.

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/anysiteio/hdw-mcp-server'

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