Skip to main content
Glama

Get Content

get_content
Read-only

Retrieve content items from LightCMS by ID or path to access titles, fields, and published states. Include rendered HTML to preview how content appears to visitors.

Instructions

Get a single content item by ID or path. Returns full content including all field data (title, slug, full_path, data fields, published state).

Prefer path when you know the URL: {"path": "/about"} Use id when you have the MongoDB ObjectID: {"id": "abc123"}

Set include_rendered=true to also receive the fully rendered HTML output (template + theme header/footer applied). Useful for verifying what visitors see without publishing.

Tip: to preview unsaved edits before publishing, use preview_content instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoContent ID (MongoDB ObjectID)
include_renderedNoIf true, include the fully rendered HTML output in the response
pathNoContent path (e.g., /about or /blog/my-post)

Implementation Reference

  • The `runQuery` function handles the chat interaction and fetching of chat results. Note: The tool 'get_content' was not found in the codebase, but `runQuery` appears to be the mechanism for fetching content via `/api/chat`.
    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 declare readOnlyHint=true, so the description appropriately focuses on output behavior rather than safety. It adds valuable context about what 'rendered' means (template + theme header/footer) and clarifies the difference between published content and preview states, though it could mention caching or error behaviors.

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?

Four tightly structured sentences that front-load the core purpose, followed by specific parameter guidance, optional flag explanation, and cross-reference. Every clause earns its place without redundancy.

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

Completeness5/5

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

With no output schema provided, the description comprehensively compensates by detailing exactly what fields are returned (title, slug, data fields, published state) and the optional rendered HTML output. It addresses the key sibling relationship with preview_content, leaving no critical gaps for a read operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 100% schema coverage, the description adds substantial value with concrete JSON syntax examples ({'path': '/about'}), semantic usage guidance distinguishing URL vs ObjectID scenarios, and detailed explanation of the rendered output behavior beyond the boolean flag description.

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

Purpose5/5

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

Description clearly states the specific action (get), resource (single content item), and identification methods (ID or path). It distinguishes from sibling tools by explicitly mentioning 'preview_content' as an alternative for unsaved edits and implies singularity versus '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 Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit guidance on when to use each identifier ('Prefer path when you know the URL', 'Use id when you have the MongoDB ObjectID'). It explicitly states when NOT to use this tool ('use preview_content instead' for unsaved edits), giving clear alternatives.

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