Get LinkedIn Organization
linkedin_get_organizationRetrieve 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
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "linkedin_get_organization"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lookup_by | No | How to look up the organization: by numeric 'id' or by 'vanity_name' (URL slug) | id |
| organization_id | No | Numeric organization ID (required when lookup_by='id'). Example: '1234567' from linkedin.com/company/1234567 | |
| vanity_name | No | 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 | No | Output format: 'markdown' for human-readable or 'json' for machine-readable | markdown |
Implementation Reference
- src/tools/organizations.ts:113-170 (handler)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) }] }; } } - src/tools/organizations.ts:8-33 (schema)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(); - src/tools/organizations.ts:65-171 (registration)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) }] }; } } ); - src/tools/organizations.ts:23-33 (registration)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(); - src/tools/organizations.ts:48-61 (helper)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"); }