Skip to main content
Glama

Search Articles

search_articles

Find articles on Emlog blogs by keyword, tag, or category. Filter and sort results by views or comment counts for precise content discovery.

Instructions

Search articles by keyword, tag, or category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of articles per page
keywordNoSearch keyword for article titles
orderNoSort order: views (by view count) or comnum (by comment count)
pageNoPage number (default: 1)
sort_idNoFilter by category ID
tagNoFilter by tag

Implementation Reference

  • Handler function for the 'search_articles' tool. It calls emlogClient.getArticleList with the provided search parameters and formats the returned articles into a readable text list with pagination info.
      async ({ keyword, tag, sort_id, page, count, order }) => {
        try {
          const result = await emlogClient.getArticleList({
            keyword,
            tag,
            sort_id,
            page,
            count,
            order
          });
          const articles = result.articles;
          const articleList = articles.map((article: any) => 
            `- ${article.title} (ID: ${article.id}) - Views: ${article.views}, Comments: ${article.comnum}`
          ).join('\n');
          return {
            content: [{
              type: "text",
              text: `Found ${articles.length} articles (Page ${result.page}/${result.total_pages}):\n\n${articleList || 'No articles found'}`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: `Error: ${error instanceof Error ? error.message : String(error)}`
            }],
            isError: true
          };
        }
      }
    );
  • Input schema using Zod for validating parameters to the search_articles tool: keyword, tag, category (sort_id), pagination (page, count), and sorting (order).
      inputSchema: {
        keyword: z.string().optional().describe("Search keyword for article titles"),
        tag: z.string().optional().describe("Filter by tag"),
        sort_id: z.number().optional().describe("Filter by category ID"),
        page: z.number().optional().describe("Page number (default: 1)"),
        count: z.number().optional().describe("Number of articles per page"),
        order: z.enum(["views", "comnum"]).optional().describe("Sort order: views (by view count) or comnum (by comment count)")
      }
    },
  • src/index.ts:311-355 (registration)
    Registers the search_articles tool with the MCP server using server.registerTool, including title, description, inputSchema, and the handler function.
    server.registerTool(
      "search_articles",
      {
        title: "Search Articles",
        description: "Search articles by keyword, tag, or category",
        inputSchema: {
          keyword: z.string().optional().describe("Search keyword for article titles"),
          tag: z.string().optional().describe("Filter by tag"),
          sort_id: z.number().optional().describe("Filter by category ID"),
          page: z.number().optional().describe("Page number (default: 1)"),
          count: z.number().optional().describe("Number of articles per page"),
          order: z.enum(["views", "comnum"]).optional().describe("Sort order: views (by view count) or comnum (by comment count)")
        }
      },
      async ({ keyword, tag, sort_id, page, count, order }) => {
        try {
          const result = await emlogClient.getArticleList({
            keyword,
            tag,
            sort_id,
            page,
            count,
            order
          });
          const articles = result.articles;
          const articleList = articles.map((article: any) => 
            `- ${article.title} (ID: ${article.id}) - Views: ${article.views}, Comments: ${article.comnum}`
          ).join('\n');
          return {
            content: [{
              type: "text",
              text: `Found ${articles.length} articles (Page ${result.page}/${result.total_pages}):\n\n${articleList || 'No articles found'}`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: `Error: ${error instanceof Error ? error.message : String(error)}`
            }],
            isError: true
          };
        }
      }
    );
  • Supporting method in EmlogClient that makes the HTTP GET request to the Emlog API endpoint '/?rest-api=article_list' with search parameters to retrieve the list of matching articles.
    async getArticleList(params: {
      page?: number;
      count?: number;
      sort_id?: number;
      keyword?: string;
      tag?: string;
      order?: 'views' | 'comnum';
    } = {}): Promise<{ articles: EmlogPost[]; page: number; total_pages: number; has_more: boolean }> {
      const queryParams = this.buildParams(params);
      const response = await this.api.get(`/?rest-api=article_list&${queryParams.toString()}`);
      return response.data.data;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the search functionality but doesn't describe pagination behavior (implied by 'page' parameter), rate limits, authentication requirements, or what the response format looks like (no output schema exists). This leaves significant gaps for a search tool.

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

Conciseness5/5

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

The description is extremely concise - a single sentence that efficiently communicates the core functionality. There's no wasted language, and it's appropriately front-loaded with the essential information about what the tool does.

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

Completeness2/5

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

For a search tool with 6 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain the search behavior (AND/OR logic), result format, pagination details, or error conditions. The agent would need to infer too much from just the parameter descriptions.

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 description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description mentions keyword, tag, and category filtering but doesn't add meaningful semantic context beyond what the schema provides about these parameters. Baseline 3 is appropriate when schema does the heavy lifting.

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's purpose as searching articles using specific criteria (keyword, tag, or category). It uses a specific verb ('Search') and identifies the resource ('articles'), but doesn't explicitly differentiate from sibling tools like 'get_article' which retrieves a single article rather than searching multiple.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_article' for retrieving specific articles or 'get_draft_list' for draft articles, nor does it specify prerequisites or contextual constraints for searching.

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

Related 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/eraincc/emlog-mcp'

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