Skip to content

Agent-friendly tool naming and leaner search payloads - #39

Merged
jlitola merged 2 commits into
mainfrom
phrygian-effect
Apr 27, 2026
Merged

Agent-friendly tool naming and leaner search payloads#39
jlitola merged 2 commits into
mainfrom
phrygian-effect

Conversation

@jlitola

@jlitola jlitola commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • MCP tool names now mirror the CLI command path (<group>_<verb>): code_files / code_read / code_grep, pkg_info / pkg_vulns / pkg_deps / pkg_changelog, docs_list / docs_read. Top-level tools (search, search_status, get_example, search_language, feedback) keep their names. Mental model collapses to one rule.
  • Drops the legacy code search-symbols CLI command, search_symbols MCP tool, and the searchSymbols service path. Unified search with sources:["symbol"] covers the same ground; ~800 LOC of duplicated request/response/test scaffolding goes with it. Internal type renames follow (SearchSymbolsKindSymbolKind, etc.).
  • Trims the search response: drops dead-weight symbolRef / fileContentHash, omits qualifiedPath when it equals title, drops the redundant query.targets echo, and only emits request defaults / compiled query / progress / sourceStatus entries when they carry information the caller didn't already supply. Empty arrays and healthy lifecycle states (INDEXED, CURRENT, STALE) fall out.
  • Hits no longer carry followUp / alternateFollowUps objects — type plus locator already tells agents the next tool to call, and the search description teaches that mapping.
  • docs_read / docs read gains line-range support (start_line / end_line and --lines 10-40) so long pages don't blow context windows. Response carries totalLines for follow-up slicing.
  • example / get_example now surface solution_id as a top-level field on the JSON payload so agents can pass it straight to feedback.
  • Always-on tools (get_example, search_language, feedback) emit the same structured {error, code, retryable} envelope as the capability-gated ones.
  • Smaller polish: githits --help shows search / search-status next to the other gated groups, code files / code grep show descriptive positional names, search description tightened, search_language switched to compact JSON, --no-color no longer confuses gated registration, auth status no longer prints env-token prefixes.

Test plan

  • bun test — 1376 / 1376 pass
  • bun run build — clean
  • Live tools/list over MCP stdio confirms the 14 expected tool names
  • Live search, pkg info, docs list, docs read --lines, code files, code read, code grep, example --json against production
  • solution_id extraction verified live (example --json returns it)
  • Top-level --help registers search / search-status correctly under override and capability flags

🤖 Generated with Claude Code

jlitola added 2 commits April 27, 2026 13:34
Reshapes the MCP and CLI surfaces so agents and humans see the same
vocabulary, and trims the JSON envelopes so each tool response says
only what's actually useful.

MCP tool names now mirror the CLI command path (`<group>_<verb>`):

  list_files             → code_files
  read_file              → code_read
  grep_repo              → code_grep
  package_summary        → pkg_info
  package_vulnerabilities → pkg_vulns
  package_dependencies   → pkg_deps
  package_changelog      → pkg_changelog
  list_package_docs      → docs_list
  read_package_doc       → docs_read

Top-level tools (`search`, `search_status`, `get_example`,
`search_language`, `feedback`) keep their names since they have no
CLI group to mirror. The mental model collapses to one rule: MCP
tool name = CLI command path with `_` separator.

The legacy symbol-search surface goes with the rename. The unified
`search` tool with `sources:["symbol"]` covers the same use case, so
the duplicate `code search-symbols` CLI command, `search_symbols`
MCP tool, `searchSymbols` service method, and their request /
response / test scaffolding are removed (~800 LOC). Internal types
follow: `SearchSymbolsKind` → `SymbolKind`, `SearchSymbolsFileIntent`
→ `FileIntent`, `SearchSymbolsResolution` → `IndexResolution`.

Search response is leaner. Hits drop the dead-weight `symbolRef` and
`fileContentHash` (no follow-up tool consumed them) and now omit
`qualifiedPath` when it equals `title` (the common case for
top-level symbols). The `query` echo drops the redundant `targets`
field, omits `compiled` when it equals `raw`, and only includes
`limit` / `offset` / `waitTimeoutMs` / `allowPartialResults` when
the caller set them. `progress` slims to status / counters /
elapsed / expiry — no more duplicating top-level fields — and is
omitted entirely on completed responses. `sourceStatus` entries are
omitted unless something actionable is reported (ignored or
incompatible filters / query features, non-healthy lifecycle
states, free-form notes). Empty arrays and default-valued scalars
fall out everywhere they don't change semantics.

Hits also lose the redundant `followUp` / `alternateFollowUps`
objects: each hit's `type` plus its `locator` already tells agents
which tool to call next, and the `search` description now teaches
that mapping in one sentence. `docs_list` entries lose the same
duplicate `followUp` / `readFile` companion objects.

`docs_read` / `docs read` gains `start_line` / `end_line` (MCP) and
`--lines 10-40` (CLI) so long pages don't blow context windows.
Slicing happens client-side for now and the response carries
`totalLines` so the next slice can be targeted.

`example` / `get_example` now surface `solution_id` as a top-level
field on the JSON payload — extracted from the markdown body URL —
so agents can pass it straight to `feedback` without scraping
prose.

The always-on tools (`get_example`, `search_language`, `feedback`)
get the structured `{error, code, retryable}` envelope used by the
capability-gated tools, so error handling is uniform across the
surface.

Smaller polish:

- `githits --help` now eagerly registers `search` / `search-status`
  next to the other capability-gated groups; previous gate was
  stricter than the docs claimed.
- `code files` / `code grep` show descriptive positional names
  (`spec-or-prefix`, `path-prefix`, `spec-or-pattern`, …) instead of
  `arg1` / `arg2` / `arg3`.
- `search` description trims an explicit syntax/qualifier table down
  to a single sentence; examples stay.
- `example` / `feedback` / `search_language` MCP descriptions drop
  Args/Returns boilerplate that duplicated the schema.
- `search_language` now emits compact JSON (was pretty-printed).
- `githits --no-color` no longer confuses the gated-group sniffer;
  `auth status` no longer prints the env-token prefix.
- `mcp-cli-parity.md`, `tools.md`, and `cli-commands.md` updated to
  the new tool names and envelope shape.

Bundle: 308 KB → ~290 KB raw (71 KB → 67 KB gzip). All 1376 tests
pass.
Patch release covering the agent-friendly tool naming and
search-payload trim.
@jlitola
jlitola merged commit c122a1b into main Apr 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant