Skip to main content
Glama
coji

Journal MCP Server

by coji

search_entries

Find journal entries using date ranges, tags, or keywords to locate specific content in your personal journal.

Instructions

Search journal entries by date range, tags, or keywords

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateFromNoStart date in YYYY-MM-DD format
dateToNoEnd date in YYYY-MM-DD format
tagsNoTags to filter by (all must match)
keywordsNoKeywords to search in content
limitNoMaximum number of results (default 50)
offsetNoOffset for pagination (default 0)

Implementation Reference

  • MCP server tool registration for 'search_entries', defining the tool name, description, input schema (Zod), and execution handler that formats search results into a readable text response.
    this.server.tool(
      'search_entries',
      'Search journal entries by date range, tags, or keywords',
      {
        dateFrom: z
          .string()
          .optional()
          .describe('Start date in YYYY-MM-DD format'),
        dateTo: z.string().optional().describe('End date in YYYY-MM-DD format'),
        tags: z
          .array(z.string())
          .optional()
          .describe('Tags to filter by (all must match)'),
        keywords: z
          .string()
          .optional()
          .describe('Keywords to search in content'),
        limit: z
          .number()
          .optional()
          .describe('Maximum number of results (default 50)'),
        offset: z
          .number()
          .optional()
          .describe('Offset for pagination (default 0)'),
      },
      async (args): Promise<CallToolResult> => {
        const result = await searchEntries(args);
    
        let response = `šŸ“– Found ${result.total} journal entries`;
        if (result.hasMore) {
          response += ` (showing ${result.entries.length})`;
        }
        response += '\n\n';
    
        for (const file of result.entries) {
          response += `**${file.date}** - ${file.entries_count} entries\n`;
          response += `Tags: ${file.tags.join(', ') || 'None'}\n`;
    
          for (const entry of file.entries) {
            response += `\nšŸ“ ${entry.timestamp} - ${entry.title}\n`;
            response += `${entry.content.slice(0, 200)}${
              entry.content.length > 200 ? '...' : ''
            }\n`;
          }
          response += '\n---\n\n';
        }
    
        return {
          content: [
            {
              type: 'text',
              text: response,
            },
          ],
        };
      }
    );
  • Core implementation of searchEntries: discovers journal .md files, parses content into JournalFile structures using gray-matter and custom parsers, filters by date/tags/keywords, sorts by date descending, applies pagination, returns JournalSearchResult.
    export async function searchEntries(
      options: JournalSearchOptions = {}
    ): Promise<JournalSearchResult> {
      const entriesDir = getEntriesDir();
      await ensureDir(entriesDir);
    
      // Find all markdown files
      const pattern = `${entriesDir}/**/*.md`;
      const files = await glob(pattern, { onlyFiles: true });
    
      let journalFiles: JournalFile[] = [];
    
      // Parse all files
      for (const filePath of files) {
        const content = await readFileIfExists(filePath);
        if (!content) continue;
    
        try {
          const journalFile = await parseJournalFile(filePath, content);
          journalFiles.push(journalFile);
        } catch (error) {
          console.warn(`Failed to parse journal file ${filePath}:`, error);
        }
      }
    
      // Apply filters
      journalFiles = filterJournalFiles(journalFiles, options);
    
      // Sort by date (newest first)
      journalFiles.sort(
        (a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()
      );
    
      // Apply pagination
      const offset = options.offset || 0;
      const limit = options.limit || 50;
      const total = journalFiles.length;
      const paginatedFiles = journalFiles.slice(offset, offset + limit);
    
      return {
        entries: paginatedFiles,
        total,
        hasMore: offset + limit < total,
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions searchable criteria but doesn't describe important behaviors like whether this is a read-only operation, what the return format looks like, whether results are paginated, or any performance considerations. For a search tool with 6 parameters, this leaves significant gaps in understanding how it behaves.

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 at just 9 words, front-loading the core functionality without any wasted words. Every element ('Search journal entries by date range, tags, or keywords') directly contributes to understanding the tool's purpose.

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 insufficiently complete. It doesn't explain what the tool returns, how results are structured, whether it's paginated, or any behavioral constraints. The agent would need to guess about important aspects of tool behavior and output.

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?

The description mentions three search criteria (date range, tags, keywords) which map to some of the 6 parameters. However, with 100% schema description coverage, the schema already fully documents all parameters including 'limit' and 'offset'. The description adds minimal value beyond what's already in the structured schema, meeting the baseline for high schema coverage.

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 'Search journal entries by date range, tags, or keywords', which includes a specific verb ('Search') and resource ('journal entries'). It distinguishes from some siblings like 'add_entry' (creation) and 'list_tags' (metadata listing), but doesn't explicitly differentiate from 'get_recent_entries' or 'get_entry_by_date' which might also retrieve entries.

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 like 'get_recent_entries' or 'get_entry_by_date'. It mentions searchable criteria but doesn't indicate when this search capability is preferred over simpler retrieval methods, nor does it mention any 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/coji/journal-mcp'

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