Package com.tnsai.tools.project
Class ProjectTools
java.lang.Object
com.tnsai.tools.project.ProjectTools
Function-shape project-context tools — read AGENTS.md / CLAUDE.md /
README.md from a project directory so the agent picks up project-
specific conventions. Replaces the legacy
AgentsmdTool.
Implements (a subset of) the AGENTS.md spec — see agents.md.
| Method | Purpose | Idempotent |
|---|---|---|
projectContext(java.lang.String) | Aggregate all context files in a directory | true |
projectReadFile(java.lang.String) | Read a single context file | true |
Pure-JDK / filesystem-only — no API key, no network call.
- Since:
- 0.5.7 (Phase 2 batch 21b — built-in tool migration to function shape, see #188)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionagentsmdGenerate(String path) agentsmdParse(String path) projectContext(String path) projectReadFile(String filePath)
-
Constructor Details
-
ProjectTools
public ProjectTools()
-
-
Method Details
-
projectContext
@Tool(name="project_context", description="Aggregate the project\'s AGENTS.md / CLAUDE.md / README.md context files into a single string the LLM can scan to pick up project-specific conventions. {path} is the project root (defaults to the JVM\'s working directory). Returns a markdown-style block with each file\'s header + content. Pure-filesystem; no auth.", keywords={"project","context","agents","claude","readme","conventions"}, idempotent=true) public String projectContext(@ToolParam(description="Project root directory (defaults to JVM working dir)",required=false,defaultValue="") String path) throws IOException - Throws:
IOException
-
projectReadFile
@Tool(name="project_read_file", description="Read a single context file (AGENTS.md / CLAUDE.md / README.md / etc.) by absolute path. Returns the raw file content. Throws NoSuchFileException when the path doesn\'t exist. Pure-filesystem; no auth.", keywords={"project","context","read","file"}, idempotent=true) public String projectReadFile(@ToolParam(description="Absolute path to the context file") String filePath) throws IOException - Throws:
IOException
-
agentsmdParse
@Tool(name="agentsmd_parse", description="Parse a project\'s AGENTS.md (or fall back to CLAUDE.md / README.md) into structured sections an agent can route on. Returns an object with `intro` (content before the first `## \u2026` heading) and `sections` (ordered list of {level, title, body}). Unlike project_context, this returns structure rather than a single concatenated string, so callers can pull out e.g. just the \"Setup\" section. Pure-filesystem; no auth.", keywords={"agents","agentsmd","parse","sections","context","project"}, idempotent=true) public AgentsMdContent agentsmdParse(@ToolParam(description="Project root directory (defaults to JVM working dir)",required=false,defaultValue="") String path) throws IOException - Throws:
IOException
-
agentsmdGenerate
@Tool(name="agentsmd_generate", description="Generate a draft AGENTS.md by inspecting the project root. Detects the build system from pom.xml / package.json / pyproject.toml / Cargo.toml / go.mod and fills in language-appropriate setup + test commands. Returns the markdown as a string \u2014 the caller decides whether to write it to disk. This is a starting point for the user to refine, not a polished doc. Pure-filesystem; no auth.", keywords={"agents","agentsmd","generate","draft","bootstrap","scaffold"}, idempotent=true) public String agentsmdGenerate(@ToolParam(description="Project root directory (defaults to JVM working dir)",required=false,defaultValue="") String path) throws IOException - Throws:
IOException
-