Skip to main content
Glama
koorosh-alt

ContextBuilder (ctx)

by koorosh-alt

ContextBuilder (ctx)

Context-as-a-Service MCP server for Hengam's multi-agent system. Maintains app-isolated, structured, provenance-backed context for Shopify apps and delivers "just enough context" to other agents.

Features

  • App-scoped context: Isolated context for 4 Shopify apps (Notify Me!, Subi, Discounty, Convi)

  • Agentic Graph Memory: Graph-based retrieval with multi-hop traversal, not just vector search

  • Hybrid delivery: Push starter context bundles + Pull targeted context slices

  • Observation Masking: Budget-aware compression with full transparency on what was included/excluded

  • Provenance tracking: Every statement traceable to source URL + snapshot timestamp + content hash

  • Configurable LLM: Provider-agnostic (OpenAI, Anthropic, Gemini) with editable prompt templates

  • Schema-validated: All data objects validated with Zod at boundaries

Quick Start

# Install dependencies
pnpm install

# Set up LLM API key (at least one required for refresh)
export OPENAI_API_KEY=sk-...
# or
export ANTHROPIC_API_KEY=sk-ant-...

# Run the MCP server
pnpm dev

# Run tests
pnpm test

MCP Tools

Tool

Description

ctx.refresh.app_sources

Refresh and rebuild context for an app

ctx.push.starter_context

Push compact starter context bundle

ctx.pull.context_slice

Pull targeted context slice by intent

ctx.get.app_state_summary

Get app state summary + refresh status

ctx.get.provenance

Get provenance for a bundle/slice

Architecture

Ingestion → Extraction → Graph → Delivery
  fetch       summarize    build     push/pull
  parse       extract      traverse  mask
  snapshot    score        validate  provenance

Pipeline Flow

  1. Ingestion: Fetch public web sources (listing, website, help center), parse HTML, create snapshots with content hashes

  2. Extraction: LLM-powered structuring — summarize pages, extract concepts/procedures, score observations, detect conflicts

  3. Graph: Build context graph with nodes (features, procedures, constraints, FAQs, entities) and typed edges (explains, depends_on, resolves, etc.)

  4. Delivery: Serve context via push (starter bundles) or pull (targeted slices) with observation masking and provenance

Configuration

All configuration is in config/:

  • apps.yaml — App source URLs and crawl settings

  • model-profiles.yaml — LLM provider configs (model, temperature, rate limits)

  • settings.yaml — Task bindings, budgets, masking thresholds, graph settings

  • prompt-templates/*.hbs — Handlebars templates for all 8 LLM tasks

Supported Apps (MVP)

App

Listing

Website

Help Center

Notify Me!

apps.shopify.com

notify-me.io

help.notify-me.io

Subi

apps.shopify.com

subi.co

help.subi.co

Discounty

apps.shopify.com

discounty.ai

help.discounty.ai

Convi

apps.shopify.com

conviapp.com

help.conviapp.com

Development

pnpm build          # Compile TypeScript
pnpm dev            # Run with tsx (dev mode)
pnpm test           # Run all tests
pnpm test:unit      # Run unit tests only
pnpm test:contract  # Run MCP contract tests
pnpm lint           # Type check

Requirements Coverage

Implements REQ-CTX-1 through REQ-CTX-38 from the ContextBuilder agent repository spec. See CLAUDE.md for architecture details.

Available Tools

5 tools
ctx.get.app_state_summaryB

Get a high-level summary of app context state including refresh status, available sections, and graph stats.

ParametersJSON Schema
NameRequiredDescriptionDefault
app_keyYesApp identifier

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it indicates this is a read operation ('Get'), it doesn't specify whether it requires authentication, has rate limits, returns real-time or cached data, or what happens on errors. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence that directly states the tool's purpose and lists key components. It's front-loaded with the core action and resource, with no unnecessary words or redundant information. Every element earns its place.

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

Completeness3/5

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

Given the tool's moderate complexity (single parameter, no output schema, no annotations), the description is minimally adequate. It covers what the tool returns at a high level but lacks details on behavioral traits, error handling, or output format. Without annotations or an output schema, more context would be helpful for safe invocation.

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 schema description coverage is 100%, with the single parameter 'app_key' fully documented in the schema (including its enum values). The description doesn't add any parameter-specific information beyond what the schema provides, such as explaining the significance of different app keys. With high schema coverage, the baseline score of 3 is appropriate.

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 with the verb 'Get' and specifies the resource as 'a high-level summary of app context state'. It lists specific components included (refresh status, available sections, graph stats), making the purpose concrete. However, it doesn't explicitly differentiate this tool from its siblings like 'ctx.get.provenance' or 'ctx.pull.context_slice'.

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. There's no mention of prerequisites, appropriate scenarios, or comparison to sibling tools like 'ctx.get.provenance' or 'ctx.pull.context_slice'. The agent must infer usage from the tool name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ctx.get.provenanceB

Get provenance details for a delivered context bundle or slice. Returns source snapshot references and statement-level provenance.

ParametersJSON Schema
NameRequiredDescriptionDefault
app_keyYesApp identifier
artifact_idYesBundle ID or Slice ID to get provenance for

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the return content but does not cover critical aspects like whether this is a read-only operation, potential rate limits, authentication needs, error conditions, or data format. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 a single, efficient sentence that front-loads the purpose and return value with zero wasted words. It is appropriately sized for the tool's complexity, making it easy for an agent to parse quickly.

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?

Given the lack of annotations and output schema, the description is incomplete. It covers the purpose and return types but omits behavioral details like safety, performance, or error handling. For a tool with no structured metadata, this leaves the agent under-informed about how to interact with it effectively.

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%, with both parameters well-documented in the schema (app_key as an app identifier with enum values, artifact_id as a bundle or slice ID). The description adds no additional parameter semantics beyond what the schema provides, such as examples or contextual usage, so it meets the baseline for high schema coverage.

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?

The description clearly states the specific action ('Get provenance details') and resource ('for a delivered context bundle or slice'), distinguishing it from sibling tools like ctx.get.app_state_summary or ctx.pull.context_slice by focusing on provenance rather than state or content retrieval. It explicitly mentions what is returned ('source snapshot references and statement-level provenance'), making the purpose unambiguous.

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, such as ctx.get.app_state_summary for app-level summaries or ctx.pull.context_slice for content retrieval. It lacks context about prerequisites, typical use cases, or exclusions, leaving the agent to infer usage based on the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ctx.pull.context_sliceC

Pull a targeted context slice for an app based on intent, budget, and required sections. Uses graph-based retrieval and observation masking.

ParametersJSON Schema
NameRequiredDescriptionDefault
request_idYesUnique request ID
app_keyYesApp identifier
intentYesRequest intent
query_textNoFree-text query
entitiesNoEntity names to focus on
required_sectionsNoSections that must be included
excluded_sectionsNoSections to exclude
budgetYesOutput budget constraints
languageNoen

TDQS

C2.9/5.0
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 'graph-based retrieval and observation masking', which hints at technical implementation but doesn't clarify behavioral traits like whether this is a read-only operation, potential side effects, performance characteristics, or error handling. For a tool with 9 parameters and no annotations, 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 a single, efficient sentence that front-loads the core purpose. Every word earns its place: 'Pull' (action), 'targeted context slice' (resource), 'for an app' (scope), 'based on intent, budget, and required sections' (key parameters), and 'Uses graph-based retrieval and observation masking' (implementation hint). No wasted words.

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?

Given the tool's complexity (9 parameters, nested objects, no output schema, and no annotations), the description is inadequate. It doesn't explain what a 'context slice' actually contains, how the graph-based retrieval works, what 'observation masking' means, or what the output looks like. For a sophisticated retrieval tool with multiple constraints and no structured output documentation, users need more context to use it effectively.

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 high (89%), so the baseline is 3. The description adds minimal value beyond the schema by mentioning 'intent, budget, and required sections' in the purpose statement, but doesn't provide additional context about parameter interactions, typical values, or usage examples. It doesn't compensate for the 11% gap in 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 action ('Pull a targeted context slice') and resource ('for an app'), specifying it's based on intent, budget, and required sections. It distinguishes from siblings by mentioning graph-based retrieval and observation masking, which none of the sibling tools reference. However, it doesn't explicitly differentiate from all siblings (e.g., vs 'ctx.get.app_state_summary').

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 'ctx.get.app_state_summary' or 'ctx.get.provenance'. It mentions the parameters (intent, budget, sections) but doesn't explain the appropriate contexts or scenarios for choosing this tool over others. No exclusions or prerequisites are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ctx.push.starter_contextC

Push a compact starter context bundle for an app. Returns product overview, key concepts, constraints, and a navigation map for deeper slices.

ParametersJSON Schema
NameRequiredDescriptionDefault
app_keyYesApp identifier
target_agent_idsNoTarget agent IDs receiving this context

TDQS

C2.9/5.0
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 the tool 'returns' specific content (product overview, etc.), which hints at a read-like operation, but doesn't clarify if this is a mutation (pushing data) or a query, nor does it address permissions, rate limits, or side effects. The term 'push' suggests an action that might affect state, but this isn't elaborated, leaving behavioral traits unclear.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, stating the core action and return values in a single, efficient sentence. Every part earns its place by specifying what is pushed and what is returned, with no redundant information. It could be slightly more structured by separating purpose from outputs, but it remains clear and concise.

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

Completeness3/5

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

Given the tool's complexity (2 parameters, no output schema, no annotations), the description is moderately complete. It covers the purpose and outputs but lacks details on behavioral aspects, usage context, and parameter significance. Without annotations or output schema, more information on side effects or return format would be beneficial, making it adequate but with clear gaps for a tool that involves 'pushing' context.

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 both parameters ('app_key' with enum values and 'target_agent_ids'). The description adds no additional meaning beyond what the schema provides—it doesn't explain the significance of the 'app_key' choices or how 'target_agent_ids' are used. Baseline 3 is appropriate as the schema handles the heavy lifting, but the description doesn't compensate with extra insights.

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: 'Push a compact starter context bundle for an app' with specific outputs (product overview, key concepts, constraints, navigation map). It distinguishes from siblings like 'ctx.get.app_state_summary' (which retrieves state) and 'ctx.pull.context_slice' (which pulls slices) by emphasizing pushing a starter bundle. However, it doesn't explicitly contrast with all siblings (e.g., 'ctx.refresh.app_sources'), keeping it from a perfect score.

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 when this starter context is needed (e.g., initial setup, onboarding) or when other tools like 'ctx.get.app_state_summary' or 'ctx.pull.context_slice' might be more appropriate. Usage is implied by the action 'push' but lacks explicit context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ctx.refresh.app_sourcesC

Refresh and rebuild app context state + graph for a given app. Fetches public web sources, extracts structured content, builds context graph.

ParametersJSON Schema
NameRequiredDescriptionDefault
app_keyYesApp identifier
forceNoForce full rebuild even if no changes detected
idempotency_keyNoIdempotency key for deduplication

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'refresh and rebuild' and 'force full rebuild', implying a mutation operation that could be resource-intensive or have side effects, but it fails to detail critical aspects like required permissions, rate limits, potential data loss, or response format. This is a significant gap for a tool with no annotation coverage.

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 highly concise and front-loaded, using a single sentence that efficiently conveys the core action and key steps without unnecessary words. Every part of the sentence earns its place by specifying the operation and its components, making it easy to parse quickly.

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?

Given the complexity of a tool that rebuilds app context state and graphs, with no annotations and no output schema, the description is insufficient. It omits crucial details like what 'structured content' entails, how the graph is built, error handling, or the return value. This leaves significant gaps for an agent to understand the tool's full behavior and outcomes.

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 parameters. The description does not add any semantic details beyond the schema, such as explaining the implications of 'force' or 'idempotency_key' in the context of refreshing app sources. With high schema coverage, the baseline score of 3 is appropriate, as the description does not compensate but also does not detract.

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 action ('Refresh and rebuild') and the target ('app context state + graph for a given app'), with specific details about fetching web sources and building a graph. However, it does not explicitly distinguish this from sibling tools like 'ctx.get.app_state_summary' or 'ctx.pull.context_slice', which might involve similar app context operations, leaving some ambiguity in differentiation.

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 lacks context on prerequisites, such as whether the app must be pre-configured, or exclusions, like when to use 'ctx.get.app_state_summary' for read-only checks instead. This absence of usage context leaves the agent without clear direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv0.1.0
    • First observedctx.get.app_state_summary
    • First observedctx.get.provenance
    • First observedctx.pull.context_slice
    • First observedctx.push.starter_context
    • First observedctx.refresh.app_sources

TDQS

A3.6/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: get.app_state_summary retrieves status metadata, get.provenance provides source tracking, pull.context_slice fetches targeted content, push.starter_context delivers initial context, and refresh.app_sources rebuilds the underlying data. There is no functional overlap or ambiguity between these operations.

Naming Consistency5/5

All tools follow a consistent verb.object pattern with dot notation (e.g., get.app_state_summary, pull.context_slice). The naming is uniform across all five tools, using clear action verbs (get, pull, push, refresh) paired with descriptive nouns.

Tool Count5/5

With 5 tools, this server is well-scoped for context management. Each tool serves a specific role in the lifecycle (retrieval, delivery, refresh), and there are no extraneous or missing tools for the apparent domain of building and managing application context.

Completeness5/5

The tool set provides complete coverage for context lifecycle operations: retrieving state and provenance (get), pulling targeted slices (pull), pushing starter bundles (push), and refreshing sources (refresh). This covers core workflows from initialization to updates without obvious gaps.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

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/koorosh-alt/hengam-context-builder'

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