Skip to main content
Glama

construct_knowledge

Extract entities and relationships from unstructured text into a validated Canonical Knowledge Structure, saved as a new session with session and version IDs.

Instructions

Build a Canonical Knowledge Structure from free-form text using an LLM. The LLM extracts entities and relationships, generates a valid CKS JSON payload, which is then parsed and validated before being persisted as a new session. Provider is auto-selected (CKS_LLM_PROVIDER): a local Ollama server if reachable (no API key needed), else Anthropic if ANTHROPIC_API_KEY is set. Returns 'session_id', 'version_id', and the serialized structure. Use 'hint' to direct the extraction toward specific aspects of the text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hintNoOptional. A short description of which aspects to focus on (e.g. 'focus on causal relations between diseases and symptoms').
textYesFree-form text to extract a Knowledge Structure from.
modelNoOptional. Model name for whichever provider is selected (e.g. an Ollama model tag, or an Anthropic model). Defaults to CKS_OLLAMA_MODEL/CKS_LLM_MODEL depending on provider.
max_tokensNoOptional. Max tokens for the LLM response. Defaults to CKS_LLM_MAX_TOKENS env var, or 4096.
Behavior4/5

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

The description discloses the internal pipeline (LLM extraction, parsing, validation, persistence), provider auto-selection logic (local Ollama vs. Anthropic based on environment), and return values ('session_id', 'version_id', serialized structure). It also mentions that a new session is persisted, implying a side effect. Since there are no annotations, this level of disclosure is strong.

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 about four sentences, front-loading the primary purpose. It includes necessary details about provider selection and return values without extraneous fluff. It is compact and informative.

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?

For a complex tool with 4 parameters and no output schema, the description provides sufficient context: creation process, provider fallback logic, return identifiers, and the hint parameter. It does not explain failure modes or validation errors, but the core invocation path is well covered.

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 input schema already provides descriptions for all four parameters (100% coverage). The description adds little beyond schema – only a brief note about using 'hint'. Parameters like 'model' and 'max_tokens' are adequately explained in the schema, so the description does not need to compensate.

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 opens with 'Build a Canonical Knowledge Structure from free-form text using an LLM' – a specific verb, resource, and process. It clearly differentiates from sibling tools by stating the output is persisted as a new session, while others like export_knowledge or validate_knowledge serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

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

The description implies when to use it: when you have free-form text and want to create a knowledge structure. It provides context like using 'hint' to direct extraction, but does not explicitly name alternatives or state when not to use this tool. Since the purpose is distinct and clear, this is acceptable.

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/Deus-corp/cks-mcp'

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