Skip to main content
Glama

mark_news_as_read

Mark news articles as read to manage your reading progress and reduce clutter in the N Lobby school portal.

Instructions

Mark news articles as read

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYesArray of news article IDs to mark as read

Implementation Reference

  • src/server.ts:432-448 (registration)
    Registration of the 'mark_news_as_read' tool in the ListToolsRequestSchema handler, including description and input schema defining required 'ids' array.
    {
      name: "mark_news_as_read",
      description: "Mark news articles as read",
      inputSchema: {
        type: "object",
        properties: {
          ids: {
            type: "array",
            items: {
              type: "string",
            },
            description: "Array of news article IDs to mark as read",
          },
        },
        required: ["ids"],
      },
    },
  • The main handler for executing the 'mark_news_as_read' tool. Parses input arguments, validates presence of IDs, iterates over each ID calling the underlying API method this.api.markNewsAsRead(newsId), collects results and errors, and formats a response text with successes and failures.
    case "mark_news_as_read":
      try {
        const { ids } = args as { ids: string[] };
    
        if (!ids || ids.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: "Error: No news article IDs provided. Please specify 'ids' parameter with at least one ID.",
              },
            ],
          };
        }
    
        // Process each ID sequentially
        const results = [];
        const errors = [];
    
        for (const newsId of ids) {
          try {
            await this.api.markNewsAsRead(newsId);
            results.push(newsId);
          } catch (error) {
            errors.push({
              id: newsId,
              error:
                error instanceof Error ? error.message : "Unknown error",
            });
          }
        }
    
        // Prepare response message
        let responseText = "";
    
        if (results.length > 0) {
          responseText += `Successfully marked ${results.length} news article(s) as read: ${results.join(", ")}\n`;
        }
    
        if (errors.length > 0) {
          responseText += `\nFailed to mark ${errors.length} news article(s) as read:\n`;
          errors.forEach(({ id, error }) => {
            responseText += `- ${id}: ${error}\n`;
          });
        }
    
        return {
          content: [
            {
              type: "text",
              text: responseText.trim(),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error marking news as read: ${error instanceof Error ? error.message : "Unknown error"}`,
            },
          ],
        };
      }

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/minagishl/nlobby-mcp'

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