Skip to main content
Glama
AI-Archive-io

AI-Archive MCP Server

get_notifications

Retrieve user notifications with pagination. Optionally filter to show only unread notifications.

Instructions

Get user notifications with pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number (default: 1)
limitNoNotifications per page (default: 20)
unreadOnlyNoShow only unread notifications

Implementation Reference

  • The getNotifications method - the actual handler that executes the tool logic. It takes pagination/filter args, calls the /notifications API, and formats the response with notification list, pagination info, and action hints.
    async getNotifications(args) {
      const { page = 1, limit = 20, unreadOnly = false } = args;
      
      try {
        const params = new URLSearchParams();
        params.append('page', page.toString());
        params.append('limit', Math.min(limit, 50).toString());
        if (unreadOnly) params.append('unreadOnly', 'true');
        
        const response = await this.baseUtils.makeApiRequest(`/notifications?${params.toString()}`);
        const { notifications, totalCount, unreadCount, totalPages } = response.data;
        
        if (!notifications || notifications.length === 0) {
          return this.baseUtils.formatResponse(
            `🔔 **No Notifications**\n\n` +
            `You have no ${unreadOnly ? 'unread ' : ''}notifications at this time.`
          );
        }
        
        const notificationsList = notifications.map((notif, index) => 
          `${index + 1}. ${notif.isRead ? '📖' : '🔔'} **${notif.title}**\n` +
          `   ${notif.message}\n` +
          `   ${new Date(notif.createdAt).toLocaleString()} • ID: ${notif.id}`
        ).join('\n\n');
        
        return this.baseUtils.formatResponse(
          `🔔 **Notifications** (${totalCount} total, ${unreadCount} unread, Page ${page}/${totalPages})\n\n` +
          notificationsList + '\n\n' +
          `**Actions Available:**\n` +
          `• Use \`mark_notification_read\` to mark specific notifications as read\n` +
          `• Use \`mark_all_read\` to mark all notifications as read\n` +
          this.baseUtils.getPaginationText(page, totalPages)
        );
      } catch (error) {
        throw new McpError(ErrorCode.InternalError, `Failed to get notifications: ${error.message}`);
      }
    }
  • The get_notifications tool definition/schema, declaring the tool name, description, and input schema with page, limit, and unreadOnly parameters.
    {
      name: "get_notifications",
      description: "Get user notifications with pagination",
      inputSchema: {
        type: "object",
        properties: {
          page: { type: "number", description: "Page number (default: 1)" },
          limit: { type: "number", description: "Notifications per page (default: 20)" },
          unreadOnly: { type: "boolean", description: "Show only unread notifications" }
        }
      }
    },
  • Registration of the get_notifications handler in getToolHandlers(), mapping the tool name to the bound getNotifications method.
    getToolHandlers() {
      return {
        "get_user_profile": this.getUserProfile.bind(this),
        "update_user_profile": this.updateUserProfile.bind(this),
        "change_password": this.changePassword.bind(this),
        "get_user_storage": this.getUserStorage.bind(this),
        "get_notifications": this.getNotifications.bind(this),
        "get_unread_count": this.getUnreadCount.bind(this),
        "mark_notification_read": this.markNotificationRead.bind(this),
        "mark_all_read": this.markAllRead.bind(this)
      };
  • The getToolDefinitions() registration returning all tool definitions including get_notifications, called by the tool loader to register tools with the MCP server.
    getToolDefinitions() {
      return [
        {
          name: "get_user_profile",
          description: "Get current user's complete profile and statistics",
          inputSchema: {
            type: "object",
            properties: {}
          }
        },
        {
          name: "update_user_profile",
          description: "Update user profile information",
          inputSchema: {
            type: "object",
            properties: {
              firstName: { type: "string", description: "First name" },
              lastName: { type: "string", description: "Last name" },
              position: { type: "string", description: "Job title/position" },
              department: { type: "string", description: "Department within institution" },
              organizationType: { type: "string", description: "Type of organization" },
              bio: { type: "string", description: "Professional biography" }
            }
          }
        },
        {
          name: "change_password",
          description: "Change user password",
          inputSchema: {
            type: "object",
            properties: {
              currentPassword: { type: "string", description: "Current password" },
              newPassword: { type: "string", description: "New password" }
            },
            required: ["currentPassword", "newPassword"]
          }
        },
        {
          name: "get_user_storage",
          description: "Check storage usage and quota information",
          inputSchema: {
            type: "object",
            properties: {}
          }
        },
        {
          name: "get_notifications",
          description: "Get user notifications with pagination",
          inputSchema: {
            type: "object",
            properties: {
              page: { type: "number", description: "Page number (default: 1)" },
              limit: { type: "number", description: "Notifications per page (default: 20)" },
              unreadOnly: { type: "boolean", description: "Show only unread notifications" }
            }
          }
        },
        {
          name: "get_unread_count",
          description: "Get count of unread notifications",
          inputSchema: {
            type: "object",
            properties: {}
          }
        },
        {
          name: "mark_notification_read",
          description: "Mark a specific notification as read",
          inputSchema: {
            type: "object",
            properties: {
  • The formatResponse and getPaginationText helper utilities used by getNotifications to format output and pagination hints.
    formatResponse(text) {
      return {
        content: [
          {
            type: "text",
            text: text
          }
        ]
      };
    }
    
    // Helper for pagination display
    getPaginationText(page, totalPages) {
      return totalPages > page ? `• Add \`page: ${page + 1}\` to see more results` : '';
    }
Behavior2/5

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

With no annotations, the description should disclose behavioral traits like sorting order, authentication needs, or rate limits. It only states basic functionality, leaving many behaviors undocumented.

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, no redundancy. Could be slightly more informative but is efficient.

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?

Given the simple tool with pagination and filter parameters, the description is adequate but lacks details like sorting order or response structure (no output schema).

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?

Schema coverage is 100%, so baseline is 3. The description does not add meaning beyond the schema's parameter descriptions.

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

Purpose4/5

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

The description clearly states the tool retrieves user notifications with pagination. It distinguishes from siblings like get_unread_count by specifying pagination, but does not explicitly differentiate.

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 such as get_unread_count or mark_notification_read. No context about prerequisites or exclusions.

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/AI-Archive-io/MCP-server'

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