Package com.tnsai.tools.developer
Class DeveloperTools
java.lang.Object
com.tnsai.tools.developer.DeveloperTools
Function-shape developer tools — GitHub search (4 typed methods, one per
search dimension) + JShell evaluation. Replaces the legacy
GitHubSearchTool (single dispatched tool) and JShellTool.
Five typed @Tool methods:
| Method | Backend | Idempotent |
|---|---|---|
githubSearchRepos(java.lang.String, int) | GET /search/repositories | true |
githubSearchCode(java.lang.String, int) | GET /search/code | true |
githubSearchIssues(java.lang.String, int) | GET /search/issues | true |
githubSearchUsers(java.lang.String, int) | GET /search/users | true |
jshellEval(java.lang.String) | JDK JShell | false (in-JVM, side-effect-prone) |
GitHub auth: optional GITHUB_TOKEN env var
raises the rate limit from 10/min → 30/min for search.
JShell trust model: code runs in the same JVM. The
legacy tool flagged requiresConfirmation=true; in the function-shape
world we mark it idempotent=false so the retry layer never auto-
replays it. Wrap with a tool-call filter for untrusted callers.
- Since:
- 0.5.7 (Phase 2 batch 13 — built-in tool migration to function shape, see #188)
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor — picks GITHUB_TOKEN from env (optional, raises rate limit).DeveloperTools(String githubToken) Explicit-token constructor.DeveloperTools(String githubToken, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests / shared HTTP. -
Method Summary
Modifier and TypeMethodDescriptiongithubSearchCode(String query, int limit) githubSearchIssues(String query, int limit) githubSearchRepos(String query, int limit) githubSearchUsers(String query, int limit) jshellEval(String code)
-
Constructor Details
-
DeveloperTools
public DeveloperTools()Default constructor — picks GITHUB_TOKEN from env (optional, raises rate limit). -
DeveloperTools
Explicit-token constructor. -
DeveloperTools
public DeveloperTools(String githubToken, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests / shared HTTP.
-
-
Method Details
-
githubSearchRepos
@Tool(name="github_search_repos", description="Search GitHub repositories. {query} accepts the full GitHub search syntax (e.g. \"java agent framework\", \"language:python stars:>1000\"). {limit} clamps to [1, 100]. Returns a markdown list of name / description / stars / forks / language / URL. Optional GITHUB_TOKEN raises the rate limit.", keywords={"github","git","repository","repo","search"}, idempotent=true) public String githubSearchRepos(@ToolParam(description="GitHub search query") String query, @ToolParam(description="Max results (1..100); 0 \u2192 default 10",required=false,defaultValue="0") int limit) throws IOException - Throws:
IOException
-
githubSearchCode
@Tool(name="github_search_code", description="Search GitHub code (file contents). {query} accepts GitHub code-search syntax (e.g. \"useState language:typescript\", \"class Agent path:src/main/java\"). {limit} clamps to [1, 100]. Returns matched files with repo, path, and URL.", keywords={"github","code","search","source"}, idempotent=true) public String githubSearchCode(@ToolParam(description="GitHub code-search query") String query, @ToolParam(description="Max results (1..100); 0 \u2192 default 10",required=false,defaultValue="0") int limit) throws IOException - Throws:
IOException
-
githubSearchIssues
@Tool(name="github_search_issues", description="Search GitHub issues + pull requests. {query} accepts GitHub issue-search syntax (e.g. \"is:open label:bug\", \"repo:owner/name is:pr\"). {limit} clamps to [1, 100]. Returns title / state / author / comments / URL for each.", keywords={"github","issue","pull request","pr","search"}, idempotent=true) public String githubSearchIssues(@ToolParam(description="GitHub issue/PR search query") String query, @ToolParam(description="Max results (1..100); 0 \u2192 default 10",required=false,defaultValue="0") int limit) throws IOException - Throws:
IOException
-
githubSearchUsers
@Tool(name="github_search_users", description="Search GitHub users + organizations. {query} accepts GitHub user-search syntax (e.g. \"location:turkey\", \"followers:>100 type:org\"). {limit} clamps to [1, 100]. Returns login / type / URL.", keywords={"github","user","organization","search"}, idempotent=true) public String githubSearchUsers(@ToolParam(description="GitHub user/org search query") String query, @ToolParam(description="Max results (1..100); 0 \u2192 default 10",required=false,defaultValue="0") int limit) throws IOException - Throws:
IOException
-
jshellEval
@Tool(name="jshell_eval", description="Evaluate a Java code snippet in JShell. Returns the value of the last expression (or the diagnostic messages on syntax / runtime errors). WARNING: code runs in the same JVM \u2014 wrap with a tool-call filter for untrusted callers.", keywords={"jshell","java","repl","code","execute","eval","snippet"}, idempotent=false) public String jshellEval(@ToolParam(description="Java source: expression, statement, or declaration") String code)
-