Class LinkedInTools

java.lang.Object
com.tnsai.tools.social.LinkedInTools

public class LinkedInTools extends Object
Function-shape LinkedIn tools — basic profile lookup + UGC post sharing via the LinkedIn v2 REST API. Replaces the legacy LinkedInTool.

LinkedIn's API surface is heavily partner-gated — most operations (company search, connections, jobs, full profile) require Marketing / Talent Solutions / Sales Navigator partnership approval. This POJO exposes only the two endpoints accessible with the basic "Sign In with LinkedIn" OAuth flow:

MethodEndpointIdempotent
linkedinMe()GET /v2/metrue
linkedinShare(java.lang.String, java.lang.String)POST /v2/ugcPostsfalse (publishes a new post)

Other legacy operations (company / search_companies / connections / jobs) returned informational stubs about partnership requirements; they can be added piecewise once a real consumer has the right partner tier.

Requires LINKEDIN_ACCESS_TOKEN.

Since:
0.5.7 (Phase 2 batch 31a — built-in tool migration to function shape, see #188)
  • Constructor Details

    • LinkedInTools

      public LinkedInTools()
      Default constructor — picks LINKEDIN_ACCESS_TOKEN from env.
    • LinkedInTools

      public LinkedInTools(String accessToken)
      Explicit-token constructor.
    • LinkedInTools

      public LinkedInTools(String accessToken, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper)
      Full constructor for tests / shared HTTP.
  • Method Details

    • linkedinMe

      @Tool(name="linkedin_me", description="Fetch the authenticated user\'s basic LinkedIn profile (id / firstName / lastName / profilePicture). Works with the basic \"Sign In with LinkedIn\" OAuth scope. Returns the raw JSON response. Requires LINKEDIN_ACCESS_TOKEN.", keywords={"linkedin","profile","me","user"}, idempotent=true) public String linkedinMe() throws IOException
      Throws:
      IOException
    • linkedinShare

      @Tool(name="linkedin_share", description="Publish a text-only post to the authenticated user\'s LinkedIn feed via the UGC Posts API. {visibility} is \"PUBLIC\" (default) or \"CONNECTIONS\". NOT idempotent \u2014 every call publishes a new post. Requires LINKEDIN_ACCESS_TOKEN with w_member_social scope.", keywords={"linkedin","share","post","publish","ugc"}, idempotent=false) public String linkedinShare(@ToolParam(description="Post text content") String text, @ToolParam(description="Audience visibility: PUBLIC (default) or CONNECTIONS",required=false,defaultValue="PUBLIC") String visibility) throws IOException
      Throws:
      IOException