tools
MCP tool implementations for Context-Fabric.
Tools are functions that agents can execute to interact with corpora.
Functions
function
describe_corpus(corpus: str | None = None) → dict[(str, Any)]Get corpus structure overview.
Get corpus structure overview.
Returns node types, section structure, and feature counts.
Use list_features() to browse features, describe_feature() for details,
and get_text_formats() for text encoding samples.
Args:
corpus: Corpus name (defaults to current corpus)
Returns:
Corpus overview with node types, sections, and feature counts.
Parameters
corpus: str | None= None
function
describe_features(features: str | list[str], sample_limit: int = 20, corpus: str | None = None) → dict[(str, Any)]Get detailed info about one or more features.
Get detailed info about one or more features.
Returns sample values (by frequency) and statistics for each feature.
Use after describe_corpus() to explore specific features.
Args:
features: Feature name or list of feature names (e.g., "sp" or ["sp", "vt", "vs"])
sample_limit: Max sample values to return per feature (default 20)
corpus: Corpus name (defaults to current corpus)
Returns:
For single feature: Feature details dict
For multiple features: Dict keyed by feature name with details for each
Parameters
features: str | list[str]sample_limit: int= 20corpus: str | None= None
function
get_corpus_info(corpus: str | None = None) → dict[(str, Any)]Get detailed information about a loaded corpus.
Get detailed information about a loaded corpus.
Args:
corpus: Corpus name (defaults to current corpus)
Returns:
Detailed corpus information including node types, features, and section structure.
Parameters
corpus: str | None= None
function
get_node_features(nodes: list[int], features: list[str], corpus: str | None = None) → dict[(str, Any)]Get feature values for a list of nodes.
Get feature values for a list of nodes.
Args:
nodes: List of node IDs
features: List of feature names to retrieve
corpus: Corpus name (defaults to current corpus)
Returns:
Feature values for each node.
Parameters
nodes: list[int]features: list[str]corpus: str | None= None
function
get_passages(sections: list[list[str | int]], limit: int = 50, lang: str = 'en', max_override: bool = False, corpus: str | None = None) → dict[(str, Any)]Get passages by section references.
Get passages by section references.
Args:
sections: List of section references, e.g., [['Genesis', 1, 1], ['Exodus', 2, 3]]
limit: Maximum sections to return (default 50)
lang: ISO 639 language code for section names (e.g., 'en' for English book names)
max_override: Bypass limit cap. May produce large responses - use judiciously.
corpus: Corpus name (defaults to current corpus)
Returns:
List of passages with text and node information.
Parameters
sections: list[list[str | int]]limit: int= 50lang: str= 'en'max_override: bool= Falsecorpus: str | None= None
function
get_text_formats(corpus: str | None = None) → dict[(str, Any)]Get text format samples showing how text is encoded in this corpus.
Get text format samples showing how text is encoded in this corpus.
Returns original script and transliteration pairs with diverse samples.
Use this when you need to understand text encoding for search queries.
Results are cached per corpus.
Args:
corpus: Corpus name (defaults to current corpus)
Returns:
Text format information with samples.
Parameters
corpus: str | None= None
function
list_features(kind: str = 'all', node_types: list[str] | None = None, corpus: str | None = None) → dict[(str, Any)]List all features with optional filtering.
List all features with optional filtering.
Returns a lightweight catalog of features for discovery.
Use node_types to filter by object type. For full details including
sample values, use describe_feature().
Args:
kind: Filter by feature kind - "all", "node", or "edge"
node_types: Filter to features that apply to these object types (e.g., ["word"])
corpus: Corpus name (defaults to current corpus)
Returns:
List of features with name, kind, value_type, and description.
Parameters
kind: str= 'all'node_types: list[str] | None= Nonecorpus: str | None= None
function
list_loaded_corpora() → dict[(str, Any)]List all currently loaded corpora.
List all currently loaded corpora.
Returns:
Dictionary with 'corpora' list and 'current' corpus name.
function
search(template: str, return_type: str = 'results', aggregate_features: list[str] | None = None, group_by_section: bool = False, top_n: int = 50, limit: int = 100, max_override: bool = False, corpus: str | None = None) → dict[(str, Any)]Search for patterns in the corpus.
Search for patterns in the corpus.
Args:
template: Search template (see search_syntax_guide for syntax)
return_type: What to return - "results", "count", "statistics", or "passages"
aggregate_features: For statistics: which features to aggregate (default: all low-cardinality)
group_by_section: For statistics: include distribution by section (book/chapter)
top_n: For statistics: max values per feature distribution (default 50)
limit: For results/passages: page size (default 100)
max_override: Bypass limit cap. May produce large responses - use judiciously.
corpus: Corpus name (defaults to current corpus)
Returns:
Search results formatted according to return_type.
Parameters
template: strreturn_type: str= 'results'aggregate_features: list[str] | None= Nonegroup_by_section: bool= Falsetop_n: int= 50limit: int= 100max_override: bool= Falsecorpus: str | None= None
function
search_continue(cursor_id: str, offset: int = 0, limit: int = 100, max_override: bool = False) → dict[(str, Any)]Continue a paginated search using a cursor ID.
Continue a paginated search using a cursor ID.
Args:
cursor_id: The cursor ID from a previous search
offset: Number of results to skip
limit: Maximum number of results to return (default 100)
max_override: Bypass limit cap. May produce large responses - use judiciously.
Returns:
Next page of search results.
Parameters
cursor_id: stroffset: int= 0limit: int= 100max_override: bool= False
function
search_syntax_guide(section: str | None = None) → dict[(str, Any)]Get documentation on search template syntax.
Get documentation on search template syntax.
By default returns a summary with available sections.
Call with section='relations' (or basics/structure/quantifiers/examples)
to get detailed info on a specific topic.
Args:
section: Specific section to retrieve (basics, structure, relations,
quantifiers, examples). Default: returns summary.
Returns:
Summary with section list (default) or specific section content.
Parameters
section: str | None= None