create_article_post
Post an article to LinkedIn with its URL, title, and your commentary. Optionally include an article description.
Instructions
Share an article with a URL and description.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text commentary accompanying the article. | |
| articleUrl | Yes | The URL of the article to share. | |
| articleTitle | Yes | The title of the article. | |
| articleDescription | No | An optional description of the article. |
Implementation Reference
- src/tools/content/index.ts:64-77 (handler)The handler function that executes the create_article_post tool logic. It validates required params (text, articleUrl, articleTitle), gets the user's URN, and calls createArticlePost on the LinkedInClient.
case "create_article_post": { if (!args || !args.text || !args.articleUrl || !args.articleTitle) { throw new McpError(ErrorCode.InvalidParams, "text, articleUrl, and articleTitle are required"); } const urn = await client.getMyUrn(); const result = await client.createArticlePost(urn, args.text, args.articleUrl, args.articleTitle, args.articleDescription); return { content: [ { type: "text", text: `Article post created successfully: ${JSON.stringify(result, null, 2)}`, }, ], }; - src/tools/content/index.ts:19-44 (schema)The tool definition/schema for create_article_post, including name, description, and inputSchema with parameters (text, articleUrl, articleTitle required; articleDescription optional).
{ name: "create_article_post", description: "Share an article with a URL and description.", inputSchema: { type: "object", properties: { text: { type: "string", description: "The text commentary accompanying the article.", }, articleUrl: { type: "string", description: "The URL of the article to share.", }, articleTitle: { type: "string", description: "The title of the article.", }, articleDescription: { type: "string", description: "An optional description of the article.", }, }, required: ["text", "articleUrl", "articleTitle"], }, }, - src/index.ts:68-70 (registration)Registration of the create_article_post tool via the contentTools array. When CallToolRequestSchema is triggered, the server checks if the tool name exists in contentTools and dispatches to handleContentTool.
if (contentTools.some((t) => t.name === name)) { return await handleContentTool(name, args, linkedinClient); } - src/index.ts:49-55 (registration)The ListToolsRequestSchema handler registers all tools (including create_article_post via contentTools) for MCP discovery.
tools: [ ...profileTools, ...contentTools, ...networkTools, ...organizationTools, ], }; - src/linkedin-client.ts:69-96 (helper)Helper method on LinkedInClient that constructs the LinkedIn API UGC post payload with ARTICLE media category and posts it to /ugcPosts.
async createArticlePost(authorUrn: string, text: string, articleUrl: string, articleTitle: string, articleDescription?: string) { const payload = { author: authorUrn, lifecycleState: "PUBLISHED", specificContent: { "com.linkedin.ugc.ShareContent": { shareCommentary: { text: text, }, shareMediaCategory: "ARTICLE", media: [ { status: "READY", description: { text: articleDescription || "" }, originalUrl: articleUrl, title: { text: articleTitle }, }, ], }, }, visibility: { "com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC", }, }; const response = await this.client.post("/ugcPosts", payload); return response.data; }