Skip to content

Tools

Agent tools provide external data access. Each tool exports a JSON schema constant (*_SCHEMA) and an async handler function.

Tool Overview

Module Function Schema Purpose
pubmed.py search_pubmed() SEARCH_PUBMED_SCHEMA Search PubMed for research articles by keyword
pubmed.py fetch_abstract() FETCH_ABSTRACT_SCHEMA Fetch full metadata for a PubMed article by PMID
pubmed.py fetch_paper() FETCH_PAPER_SCHEMA Fetch by PMID or DOI
web_search.py web_search() WEB_SEARCH_SCHEMA Search the web via Brave Search API
vault_reader.py read_vault_notes() READ_VAULT_NOTES_SCHEMA Hybrid search (pgvector + full-text) over vault note embeddings
keyword_data.py read_keyword_data() READ_KEYWORD_DATA_SCHEMA Look up backlog item by keyword and language
keyword_data.py get_content_architecture() GET_CONTENT_ARCHITECTURE_SCHEMA Get cornerstone + satellite structure for a pillar
vault_chunking.py chunk_note() -- Parse Obsidian markdown into embeddable chunks by heading boundary
source_scanner.py scan_source() -- Scan external sources (PubMed, RSS, etc.) for new items
image_gen.py generate_image() GENERATE_IMAGE_SCHEMA Generate featured images via DALL-E 3
sanitize.py sanitize_external_content() -- Strip control characters, collapse whitespace, truncate

Integration Pattern

Tools are wired into agents via wrapper functions that return JSON strings:

# In the agent module
async def _wrap_search_pubmed(*, query: str, max_results: int = 50) -> str:
    pmids = await search_pubmed(query, max_results=max_results)
    return json.dumps(pmids)

_TOOL_MAP = {"search_pubmed": _wrap_search_pubmed}
_TOOL_DEFINITIONS = [SEARCH_PUBMED_SCHEMA]

All tool results are sanitized via sanitize_external_content() before being sent back to the LLM.

Coming soon

Detailed documentation for each tool module's parameters and return types will be added here.