fix(agent): stop tool thrash after writes and log rounds
CI / checks (push) Has been cancelled

Cap get_api_docs, break duplicate tool rounds, force a reply after
successful writes, and log each tool call so limit hits are diagnosable.
This commit is contained in:
ginnoir
2026-07-08 22:51:31 -05:00
parent 9bf8e508c7
commit 72d123b9a0
7 changed files with 389 additions and 13 deletions
+9 -4
View File
@@ -451,13 +451,18 @@ async function getApiDocs(args: Record<string, unknown>): Promise<ApiCallResult>
const specPath = path.join(process.cwd(), "docs", "api", "openapi.yaml");
const spec = await readFile(specPath, "utf8");
const search = typeof args.search === "string" ? args.search.trim().toLowerCase() : "";
const pathLines = spec
.split("\n")
.map((line) => line.trim())
.filter((line) => line.startsWith("/api/v1/"));
if (!search) {
return {
status: 200,
body: {
spec,
hint: "Pass search to filter paths, or use call_api with a /api/v1/* path.",
paths: pathLines.slice(0, 80),
pathCount: pathLines.length,
hint: "Pass search (e.g. calendar, events, lists) to get matching lines. Do not request the full OpenAPI dump.",
},
};
}
@@ -469,8 +474,8 @@ async function getApiDocs(args: Record<string, unknown>): Promise<ApiCallResult>
body: {
search,
matchCount: matches.length,
matches: matches.slice(0, 100),
hint: "Use call_api with method and path from the matches above.",
matches: matches.slice(0, 40),
hint: "Use a dedicated tool when one exists; otherwise call_api with method and path from the matches above.",
},
};
}