Skip to main content
Glama

Search Content

search_content
Read-only

Search content items by title or full text to find specific information within LightCMS. Returns matching content with paths and context for targeted content discovery.

Instructions

Search across all content items by title or full text. Returns matching content with paths and match context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_deletedNoInclude soft-deleted content in results
queryYesSearch query string,required
search_typeNoSearch type: 'name' (title only) or 'fulltext' (all fields). Defaults to 'fulltext'

Implementation Reference

  • The runQuery function handles the client-side interaction for sending queries to the search endpoint via SSE. While not explicitly named 'search_content', it is the core handler for processing the search request and displaying the streaming response in the chat widget.
    function runQuery(query, cfg, bodyId, inputId, sendId) {
      var body = document.getElementById(bodyId);
      var sendBtn = document.getElementById(sendId);
      var input = document.getElementById(inputId);
    
      body.innerHTML = '<div class="lc-loading"><div class="lc-dot"></div><div class="lc-dot"></div><div class="lc-dot"></div></div>';
      sendBtn.disabled = true;
    
      var loadingRemoved = false;
      var answerEl = null;
      var sourcesEl = null;
      var rawAnswer = '';
    
      function removeLoading() {
        if (!loadingRemoved) {
          var l = body.querySelector('.lc-loading');
          if (l) l.remove();
          loadingRemoved = true;
        }
      }
    
      function ensureAnswer() {
        if (!answerEl) {
          removeLoading();
          answerEl = document.createElement('div');
          answerEl.className = 'lc-answer';
          body.appendChild(answerEl);
        }
        return answerEl;
      }
    
      function handleEvent(evt) {
        if (evt.type === 'token' && evt.text) {
          rawAnswer += evt.text;
          ensureAnswer().innerHTML = renderMarkdown(rawAnswer);
          body.scrollTop = body.scrollHeight;
        } else if (evt.type === 'sources') {
          removeLoading();
          var results = evt.results || [];
          if (results.length === 0 && !answerEl) {
            body.innerHTML = '<p class="lc-no-results">No results found. Try rephrasing your question.</p>';
            return;
          }
          if (results.length > 0) {
            sourcesEl = document.createElement('div');
            sourcesEl.className = 'lc-sources';
            var html = '<div class="lc-sources-label">Sources</div>';
            for (var i = 0; i < results.length; i++) {
              var r = results[i];
              html += '<a class="lc-result" href="' + escHtml(r.url) + '">' +
                '<span class="lc-result-arrow">↗</span>' +
                '<span class="lc-result-title">' + escHtml(r.title) + '</span>' +
                '</a>';
            }
            sourcesEl.innerHTML = html;
            body.appendChild(sourcesEl);
            body.scrollTop = body.scrollHeight;
          }
        } else if (evt.type === 'done') {
          sendBtn.disabled = false;
          input.value = '';
          input.focus();
        }
      }
    
      fetch(baseURL + '/api/chat?q=' + encodeURIComponent(query))
        .then(function (res) {
          if (!res.ok || !res.body) throw new Error('HTTP ' + res.status);
          var reader = res.body.getReader();
          var decoder = new TextDecoder();
          var buffer = '';
    
          function pump() {
            return reader.read().then(function (result) {
              if (result.done) { sendBtn.disabled = false; return; }
              buffer += decoder.decode(result.value, { stream: true });
              var parts = buffer.split('\n\n');
              buffer = parts.pop();
              for (var i = 0; i < parts.length; i++) {
                var p = parts[i].trim();
                if (p.indexOf('data: ') === 0) {
                  try { handleEvent(JSON.parse(p.slice(6))); } catch (e) {}
                }
              }
              return pump();
            });
          }
          return pump();
        })
        .catch(function () {
          sendBtn.disabled = false;
          body.innerHTML = '<p class="lc-no-results">Something went wrong. Please try again.</p>';
        });
    }
Behavior4/5

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

Annotations establish read-only safety (readOnlyHint: true). The description adds valuable behavioral context by specifying return structure ('paths and match context'), compensating for the missing output schema. It does not mention the soft-deletion behavior (include_deleted), though that is covered in the parameter schema.

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?

Two efficient sentences. First establishes scope (what it searches), second establishes return value (what you get). No redundancy or filler. Front-loaded with core action.

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

Completeness4/5

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

Given 100% schema coverage and simple 3-parameter structure, the description is appropriately complete. It compensates well for the missing output schema by describing the return format (paths, match context). Could benefit from pagination or result limit notes, but not required given schema simplicity.

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?

With 100% schema description coverage, the schema fully documents parameters (query, search_type, include_deleted). The description echoes the 'title or full text' distinction but does not add query syntax details (e.g., wildcards) or semantic implications beyond the schema.

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?

Clear verb ('Search') and resource ('content items') with specific scope ('title or full text'). However, it does not explicitly differentiate from siblings like 'end_user_search' or 'list_content'.

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 explicit guidance on when to use this tool versus alternatives like 'end_user_search' (which may have different permission scopes) or 'list_content' (which retrieves unfiltered lists). No mention of prerequisites or when to avoid.

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/jonradoff/lightcms'

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