Skip to main content
Glama
abhineet34

linkedin-mcp-server

Get LinkedIn Organization

linkedin_get_organization
Read-onlyIdempotent

Retrieve a LinkedIn organization's public or admin details using its numeric ID or vanity name. Returns fields like name, website, type, locations, and more.

Instructions

Retrieve a LinkedIn organization (company) page by its numeric ID or vanity name.

Without admin access, returns public fields: id, localizedName, vanityName, localizedWebsite, primaryOrganizationType, locations, and logoV2. With admin access (rw_organization_admin scope), returns additional fields like description, industries, staffCountRange, foundedOn, and specialties.

Requires scope: rw_organization_admin

Args:

  • lookup_by ('id' | 'vanity_name'): How to identify the org (default: 'id')

  • organization_id (string): Numeric org ID — required when lookup_by='id'

  • vanity_name (string): URL slug — required when lookup_by='vanity_name' E.g., 'microsoft' for linkedin.com/company/microsoft

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns: For JSON format: { "id": string, "localizedName": string, "vanityName": string, "localizedWebsite": string, "primaryOrganizationType": string, "locations": [...], // Additional fields if you have admin access }

Examples:

  • By ID: { lookup_by: "id", organization_id: "1441" } ← LinkedIn's own page

  • By vanity: { lookup_by: "vanity_name", vanity_name: "microsoft" }

Error Handling:

  • 403 if rw_organization_admin scope is missing

  • 404 if the organization ID or vanity name does not exist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lookup_byNoHow to look up the organization: by numeric 'id' or by 'vanity_name' (URL slug)id
organization_idNoNumeric organization ID (required when lookup_by='id'). Example: '1234567' from linkedin.com/company/1234567
vanity_nameNoOrganization vanity name — the slug in the LinkedIn URL. E.g., 'microsoft' for linkedin.com/company/microsoft (required when lookup_by='vanity_name')
response_formatNoOutput format: 'markdown' for human-readable or 'json' for machine-readablemarkdown

Implementation Reference

  • The main handler function for the 'linkedin_get_organization' tool. It looks up an organization either by 'id' (numeric ID) via GET /organizations/{id} or by 'vanity_name' (URL slug) via GET /organizations?q=vanityName&vanityName=..., then returns the result in markdown or JSON format.
    async (params: GetOrganizationInput) => {
      try {
        let org: LinkedInOrganization;
    
        if (params.lookup_by === "vanity_name") {
          if (!params.vanity_name) {
            return {
              content: [
                {
                  type: "text",
                  text: "Error: vanity_name is required when lookup_by='vanity_name'.",
                },
              ],
            };
          }
          const data = await restGet<{ elements: LinkedInOrganization[] }>(
            "/organizations",
            { q: "vanityName", vanityName: params.vanity_name }
          );
          if (!data.elements?.length) {
            return {
              content: [{ type: "text", text: `No organization found with vanity name '${params.vanity_name}'.` }],
            };
          }
          org = data.elements[0];
        } else {
          if (!params.organization_id) {
            return {
              content: [
                {
                  type: "text",
                  text: "Error: organization_id is required when lookup_by='id'.",
                },
              ],
            };
          }
          org = await restGet<LinkedInOrganization>(
            `/organizations/${params.organization_id}`
          );
        }
    
        const structured = org as unknown as Record<string, unknown>;
    
        if (params.response_format === ResponseFormat.JSON) {
          return {
            content: [{ type: "text", text: JSON.stringify(org, null, 2) }],
            structuredContent: structured,
          };
        }
    
        return {
          content: [{ type: "text", text: formatOrganization(org) }],
          structuredContent: structured,
        };
      } catch (error) {
        return { content: [{ type: "text", text: handleApiError(error) }] };
      }
    }
  • Zod input schema for the 'linkedin_get_organization' tool. Defines parameters: lookup_by (enum 'id'|'vanity_name'), organization_id (string, optional), vanity_name (string, optional), and response_format (enum 'markdown'|'json').
    const GetOrganizationInputSchema = z
      .object({
        lookup_by: z
          .enum(["id", "vanity_name"])
          .default("id")
          .describe("How to look up the organization: by numeric 'id' or by 'vanity_name' (URL slug)"),
        organization_id: z
          .string()
          .optional()
          .describe(
            "Numeric organization ID (required when lookup_by='id'). " +
              "Example: '1234567' from linkedin.com/company/1234567"
          ),
        vanity_name: z
          .string()
          .optional()
          .describe(
            "Organization vanity name — the slug in the LinkedIn URL. " +
              "E.g., 'microsoft' for linkedin.com/company/microsoft (required when lookup_by='vanity_name')"
          ),
        response_format: z
          .nativeEnum(ResponseFormat)
          .default(ResponseFormat.MARKDOWN)
          .describe("Output format: 'markdown' for human-readable or 'json' for machine-readable"),
      })
      .strict();
  • Registration of the 'linkedin_get_organization' tool via server.registerTool() within the registerOrganizationTools() function, including title, description, inputSchema, annotations, and the handler.
    export function registerOrganizationTools(server: McpServer): void {
      server.registerTool(
        "linkedin_get_organization",
        {
          title: "Get LinkedIn Organization",
          description: `Retrieve a LinkedIn organization (company) page by its numeric ID or vanity name.
    
    Without admin access, returns public fields: id, localizedName, vanityName,
    localizedWebsite, primaryOrganizationType, locations, and logoV2.
    With admin access (rw_organization_admin scope), returns additional fields like
    description, industries, staffCountRange, foundedOn, and specialties.
    
    Requires scope: rw_organization_admin
    
    Args:
      - lookup_by ('id' | 'vanity_name'): How to identify the org (default: 'id')
      - organization_id (string): Numeric org ID — required when lookup_by='id'
      - vanity_name (string): URL slug — required when lookup_by='vanity_name'
          E.g., 'microsoft' for linkedin.com/company/microsoft
      - response_format ('markdown' | 'json'): Output format (default: 'markdown')
    
    Returns:
      For JSON format:
      {
        "id": string,
        "localizedName": string,
        "vanityName": string,
        "localizedWebsite": string,
        "primaryOrganizationType": string,
        "locations": [...],
        // Additional fields if you have admin access
      }
    
    Examples:
      - By ID: { lookup_by: "id", organization_id: "1441" }   ← LinkedIn's own page
      - By vanity: { lookup_by: "vanity_name", vanity_name: "microsoft" }
    
    Error Handling:
      - 403 if rw_organization_admin scope is missing
      - 404 if the organization ID or vanity name does not exist`,
          inputSchema: GetOrganizationInputSchema,
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: true,
          },
        },
        async (params: GetOrganizationInput) => {
          try {
            let org: LinkedInOrganization;
    
            if (params.lookup_by === "vanity_name") {
              if (!params.vanity_name) {
                return {
                  content: [
                    {
                      type: "text",
                      text: "Error: vanity_name is required when lookup_by='vanity_name'.",
                    },
                  ],
                };
              }
              const data = await restGet<{ elements: LinkedInOrganization[] }>(
                "/organizations",
                { q: "vanityName", vanityName: params.vanity_name }
              );
              if (!data.elements?.length) {
                return {
                  content: [{ type: "text", text: `No organization found with vanity name '${params.vanity_name}'.` }],
                };
              }
              org = data.elements[0];
            } else {
              if (!params.organization_id) {
                return {
                  content: [
                    {
                      type: "text",
                      text: "Error: organization_id is required when lookup_by='id'.",
                    },
                  ],
                };
              }
              org = await restGet<LinkedInOrganization>(
                `/organizations/${params.organization_id}`
              );
            }
    
            const structured = org as unknown as Record<string, unknown>;
    
            if (params.response_format === ResponseFormat.JSON) {
              return {
                content: [{ type: "text", text: JSON.stringify(org, null, 2) }],
                structuredContent: structured,
              };
            }
    
            return {
              content: [{ type: "text", text: formatOrganization(org) }],
              structuredContent: structured,
            };
          } catch (error) {
            return { content: [{ type: "text", text: handleApiError(error) }] };
          }
        }
      );
  • Import and registration call in index.ts: registerOrganizationTools(server) is invoked on line 33, which registers all organization tools including 'linkedin_get_organization'.
        .optional()
        .describe(
          "Organization vanity name — the slug in the LinkedIn URL. " +
            "E.g., 'microsoft' for linkedin.com/company/microsoft (required when lookup_by='vanity_name')"
        ),
      response_format: z
        .nativeEnum(ResponseFormat)
        .default(ResponseFormat.MARKDOWN)
        .describe("Output format: 'markdown' for human-readable or 'json' for machine-readable"),
    })
    .strict();
  • Helper function formatOrganization() that converts a LinkedInOrganization object into a human-readable Markdown string, used when response_format is 'markdown'.
    function formatOrganization(org: LinkedInOrganization): string {
      const lines = [
        `# ${org.localizedName}`,
        "",
        `**ID:** ${org.id}`,
      ];
      if (org.vanityName) lines.push(`**Vanity Name:** ${org.vanityName}`);
      if (org.localizedWebsite) lines.push(`**Website:** ${org.localizedWebsite}`);
      if (org.primaryOrganizationType) lines.push(`**Type:** ${org.primaryOrganizationType}`);
      if (org.locations && (org.locations as unknown[]).length > 0) {
        lines.push(`**Locations:** ${(org.locations as unknown[]).length} location(s)`);
      }
      return lines.join("\n");
    }
Behavior5/5

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

Beyond annotations (readOnlyHint, idempotentHint), the description discloses critical behavioral details: auth scope (rw_organization_admin), how public vs admin access differs, return fields, and error codes (403, 404). No contradiction with annotations.

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 well-structured with logical sections: summary, access-level details, Args, Returns, Examples, Error Handling. Every sentence adds necessary information without redundancy. It is front-loaded with the core purpose and then elaborates.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

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

Given the tool's complexity (4 params, no output schema), the description covers all aspects: parameter explanations, output format options, examples, error conditions, and scope requirements. It leaves no significant gap for an agent to misinvoke the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is 100%, the description significantly adds value by explaining parameter dependencies (e.g., organization_id required when lookup_by='id'), providing concrete examples, default values, and contextual usage like 'vanity_name' from URL. This goes well beyond the schema definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Retrieve a LinkedIn organization (company) page by its numeric ID or vanity name.' It identifies the specific resource and action, and distinguishes from sibling tools like linkedin_create_post or linkedin_get_org_follower_count by focusing on retrieval of organization details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear guidance on when to use the tool (to get organization info) and what to expect with different access levels. It mentions required scope and error handling, but could explicitly state not to use it for follower counts or posts, though sibling names make that implicit.

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

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