Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat(linkedin): expose company mention lookup to the public API and MCP

Gilad Resisic0fee9eaa02f
diff --git a/libraries/nestjs-libraries/src/chat/tools/integration.schedule.post.ts b/libraries/nestjs-libraries/src/chat/tools/integration.schedule.post.ts
index 72c06abc4..a2e20cad0 100644
--- a/libraries/nestjs-libraries/src/chat/tools/integration.schedule.post.ts
+++ b/libraries/nestjs-libraries/src/chat/tools/integration.schedule.post.ts
@@ -92,7 +92,7 @@ If validation fails, the result contains output.errors describing what to fix; t
content: z
.string()
.describe(
- "The content of the post, HTML, Each line must be wrapped in <p> here is the possible tags: h1, h2, h3, u, strong, li, ul, p (you can't have u and strong together), and img (<img src=\"...\">) only when the integration rules say pictures go inside the content"
+ "The content of the post, HTML, Each line must be wrapped in <p> here is the possible tags: h1, h2, h3, u, strong, li, ul, p (you can't have u and strong together), img (<img src=\"...\">) only when the integration rules say pictures go inside the content, and span only for a mention in the exact format given by a mention tool from the integrationSchema tools"
),
attachments: z
.array(attachmentUrl)
diff --git a/libraries/nestjs-libraries/src/chat/tools/integration.validation.tool.ts b/libraries/nestjs-libraries/src/chat/tools/integration.validation.tool.ts
index 14bd16ddf..6d359688e 100644
--- a/libraries/nestjs-libraries/src/chat/tools/integration.validation.tool.ts
+++ b/libraries/nestjs-libraries/src/chat/tools/integration.validation.tool.ts
@@ -21,6 +21,7 @@ export class IntegrationValidationTool implements AgentToolInterface {
This tool helps us get the schema of the integration.
Sometimes we might get a schema back the requires some id, for that, you can get information from 'tools'
And use the triggerTool function.
+ 'tools' can also include a mention lookup, use it to tag people or pages in the post content.
`,
mcp: {
annotations: {
diff --git a/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts b/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts
index 36205c48a..38d605245 100644
--- a/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts
+++ b/libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts
@@ -23,6 +23,7 @@ import { LinkedinDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-sett
import imageToPDF from 'image-to-pdf';
import { Readable } from 'stream';
import { Rules } from '@gitroom/nestjs-libraries/chat/rules.description.decorator';
+import { Tool } from '@gitroom/nestjs-libraries/integrations/tool.decorator';
// Travels through the workflow history between postPending, checkPostStatus
// and finalizePost - keep it small JSON (media urns and the post content, never
@@ -1204,6 +1205,13 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
});
}
+ @Tool({
+ description:
+ 'Find a company page to tag by its exact vanity name (the part after linkedin.com/company/). Tag it in the post content with <span data-mention-id="{id}" data-mention-label="{label}">@{label}</span>',
+ dataSchema: [
+ { key: 'query', type: 'string', description: 'Company page vanity name' },
+ ],
+ })
override async mention(token: string, data: { query: string }) {
const { elements } = await (
await fetch(