Skip to main content
Glama

get_company_posts

Retrieve recent posts from a company's LinkedIn feed to monitor updates, analyze content, and track industry trends.

Instructions

Get recent posts from a company's LinkedIn feed.

Args: company_name: LinkedIn company name (e.g., 'google', 'stripe', 'openai')

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
company_nameYes

Implementation Reference

  • The handler function that executes the get_company_posts tool logic. It calls the ScrapeCompanyUseCase with sections='posts' and returns a dictionary containing the URL and serialized sections.
    async def get_company_posts(
        company_name: str,
        ctx: Context,
    ) -> dict[str, Any]:
        try:
            result = await scrape_company_uc.execute(company_name, sections="posts")
            return {
                "url": result.url,
                "sections": serialize_sections(result.sections),
            }
        except Exception as e:
            map_domain_error(e, "get_company_posts")
  • MCP tool registration decorator that registers the get_company_posts tool with its name and description.
    @mcp.tool(
        name="get_company_posts",
        description=(
            "Get recent posts from a company's LinkedIn feed.\n\n"
            "Args:\n"
            "    company_name: LinkedIn company name (e.g., 'google', 'stripe', 'openai')"
        ),
    )
  • Schema definition for a single company post entry, defining fields for text, time_posted, reactions, comments, and reposts.
    @dataclass
    class CompanyPostEntry:
        """A single post from a company's feed."""
    
        text: str | None = None
        time_posted: str | None = None
        reactions: str | None = None
        comments: str | None = None
        reposts: str | None = None
    
    
    @dataclass
    class CompanyPostsSection:
        """Company posts feed — extracted from /company/{name}/posts/."""
    
        posts: list[CompanyPostEntry] = field(default_factory=list)
        raw: str | None = None
  • Schema definition for the company posts section, containing a list of CompanyPostEntry objects and optional raw HTML.
    @dataclass
    class CompanyPostsSection:
        """Company posts feed — extracted from /company/{name}/posts/."""
    
        posts: list[CompanyPostEntry] = field(default_factory=list)
        raw: str | None = None
  • Helper function that serializes all sections in a response, converting typed models to JSON-serializable dicts and stripping None values.
    def serialize_sections(sections: dict[str, Any]) -> dict[str, Any]:
        """Serialize all sections in a response, stripping None values from each."""
        return {name: serialize_section(section) for name, section in sections.items()}

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/eliasbiondo/linkedin-mcp-server'

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