Skip to main content
Glama

pin_message

Pin or unpin a message in a chat to control message visibility. Use this to emphasize important announcements or reduce clutter.

Instructions

[Official API] Pin or unpin a message in a chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
message_idYesMessage ID
pinnedNotrue to pin, false to unpin

Implementation Reference

  • Input schema definition for the pin_message tool. Specifies message_id (required) and pinned (optional boolean, defaults true).
    {
      name: 'pin_message',
      description: '[Official API] Pin or unpin a message in a chat.',
      inputSchema: {
        type: 'object',
        properties: {
          message_id: { type: 'string', description: 'Message ID' },
          pinned: { type: 'boolean', description: 'true to pin, false to unpin', default: true },
        },
        required: ['message_id'],
      },
    },
  • Handler function that executes the pin_message tool logic. Calls ctx.getOfficialClient().pinMessage() with message_id and pinned flag.
    async pin_message(args, ctx) {
      return json(await ctx.getOfficialClient().pinMessage(args.message_id, args.pinned !== false));
    },
  • src/server.js:47-47 (registration)
    Tool modules registered in server.js. messaging-bot.js is loaded as one of the tool modules; its schemas and handlers are aggregated into TOOLS and HANDLERS.
    require('./tools/messaging-bot'),
  • Official API client method pinMessage that calls Feishu SDK im.pin.create (to pin) or im.pin.delete (to unpin). Handles both operations.
    async pinMessage(messageId, pinned = true) {
      if (pinned) {
        const res = await this._safeSDKCall(
          () => this.client.im.pin.create({ data: { message_id: messageId } }),
          'pinMessage'
        );
        return { pin: res.data.pin };
      }
      // Feishu unpin is DELETE /pins/{message_id} — path param only, no body.
      // SDK's pin.delete expects `path: {message_id}`. Sending `data: {message_id}`
      // (the previous shape) yielded a 400 with "message_id is required" because
      // the message_id never made it onto the URL.
      await this._safeSDKCall(
        () => this.client.im.pin.delete({ path: { message_id: messageId } }),
        'unpinMessage'
      );
      return { unpinned: true };
    },
  • Response helper functions used by the pin_message handler. 'json' serializes the result to JSON text, 'text' wraps a plain string response.
    // src/tools/_registry.js — shared infrastructure for tool modules.
    //
    // Every src/tools/<domain>.js exports:
    //   { schemas: [<MCP tool schema objects>], handlers: { [name]: async (args, ctx) => MCPResponse } }
    //
    // The ctx object that handlers receive is built in src/server.js (or, during
    // the v1.3.7 phase A migration, temporarily in src/index.js) and provides:
    //   - getUserClient():   Promise<LarkUserClient>
    //   - getOfficialClient(): LarkOfficialClient
    //   - getEventBuffer():  EventBuffer | null  — null when WS isn't running
    //   - resolveDocId(x):   Promise<string>  — wiki-node / URL → native token
    //   - listProfiles():    string[]         — names from LARK_PROFILES_JSON + 'default'
    //   - getActiveProfile():string
    //   - setActiveProfile(name): void        — invalidates cached clients
    //
    // Response builders below are imported directly by each tool module — they're
    // not on ctx because they're pure functions with no state.
    
    const text = (s) => ({ content: [{ type: 'text', text: s }] });
    
    // `json` will lift any `fallbackWarning` field to the top of the rendered
    // response so users see the warning before the structured payload. Preserved
    // from index.js v1.3.5 behaviour.
    const json = (o) => {
      const warn = o && typeof o === 'object' && o.fallbackWarning ? `${o.fallbackWarning}\n\n` : '';
      return text(warn + JSON.stringify(o, null, 2));
    };
    
    const sendResult = (r, desc) => text(r.success ? desc : `Send failed (status: ${r.status})`);
    
    module.exports = { text, json, sendResult };
Behavior2/5

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

No annotations provided, so description must carry the burden. Only states the action without disclosing side effects (e.g., notifications), permissions needed, or error conditions. Missing important behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, front-loaded with action and resource. Efficient but could benefit from slight restructuring to include usage hints.

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

Completeness3/5

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

For a two-parameter tool with no output schema, the description is somewhat complete but lacks usage and behavioral details. Adequate but has room for improvement.

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

Parameters3/5

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

Input schema has 100% coverage with clear descriptions. The description adds no new parameter meaning beyond 'in a chat'. Baseline 3 is appropriate.

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 the verb 'Pin or unpin' and the resource 'message in a chat', distinguishing it from sibling tools like delete_message or add_reaction. It is specific and unambiguous.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives like add_reaction or update_message. No exclusions or context provided. For a simple tool, this is a gap.

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/EthanQC/feishu-user-plugin'

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