zed/typos.toml
Ahmed Ghait 8906914149
agent: Show MCP tool primary argument in tool-call header (#54604)
## Problem

Built-in tools like `Fetch` render their primary argument next to the
tool name in the collapsed tool-call header (e.g. `Fetch
https://example.com`). MCP tools don't — they always show `Run MCP tool
<name>` and the argument is hidden inside the expandable "Raw Input"
JSON block.

For Playwright, fetch, search, or any MCP tool where one argument
carries all the context, this makes every call opaque. You have to click
to expand just to see which URL is being opened or which file is being
read.

Before:

```
⊙ mcp__playwright__open_url_in_browser
  [click to expand]
  Raw Input:
  {
    "url": "https://linkedin.com/in/neuodev"
  }
```

After:

```
⊙ Run MCP tool `mcp__playwright__open_url_in_browser` https://linkedin.com/in/neuodev
```

## Root cause

`ContextServerTool::initial_title` at
`crates/agent/src/tools/context_server_registry.rs` discards the input:

```rust
fn initial_title(&self, _input: serde_json::Value, _cx: &mut App) -> SharedString {
    format!("Run MCP tool `{}`", self.tool.name).into()
}
```

Built-in tools read the input (`fetch_tool.rs`: `format!("Fetch {}",
MarkdownEscaped(&input.url))`) but the generic MCP path never did.

## Change

When the MCP tool's input is a JSON object with exactly one
string-valued field, inline that value next to the tool name. All other
shapes (multi-field objects, non-string values, null/empty input) fall
back to the existing `Run MCP tool <name>` label, so behavior is
unchanged for them.

- Value is truncated at 120 chars with `…` on overflow (char-safe, not
byte-safe — "café" won't panic).
- Value is run through `MarkdownEscaped` so markdown metacharacters
render literally.
- Single-string heuristic was chosen because the MCP spec has no
standard field for a display template, and the common case (`url`,
`path`, `query`, `selector`, `name`) is covered. I considered honoring
`Tool.annotations.title` or `_meta["zed/title"]` as a template — happy
to follow up with that if the team prefers an opt-in mechanism, but
wanted to start with something that works out of the box for every
existing MCP server.

## Tests

Added 10 unit tests in the existing `mod tests` block covering: happy
path, no args, null input, multi-field fallback, non-string fallback,
truncation, markdown escaping, multibyte chars, and empty-string
preservation.

`cargo check -p agent --tests` passes locally. I couldn't run the full
test binary on my machine because `wasmtime-c-api-impl` (a transitive
test-dep) needs `cmake`, but the new code is pure string-manipulation
with no wasm/runtime touch — CI should cover.

## Scope

One file, +127/-3. No behavior change for any tool shape other than
single-string-input MCP tools.

## Per CONTRIBUTING.md

Happy to convert to a discussion first if the team prefers — didn't see
a tracking issue for this. Also filed under CLA (signed).

Release Notes:

- Show MCP tool primary argument in tool header if space allows

---------

Co-authored-by: Chris Biscardi <chris@christopherbiscardi.com>
2026-07-13 14:00:40 +00:00

112 lines
4 KiB
TOML

[files]
ignore-files = true
ignore-hidden = false
extend-exclude = [
".git/",
# Typewriter model names used for agent branch names aren't typos.
"crates/agent_ui/src/branch_names.rs",
# Contributor names aren't typos.
".mailmap",
# File suffixes aren't typos.
"crates/theme/src/icon_theme.rs",
"crates/extensions_ui/src/extension_suggest.rs",
# Some mock data is flagged as typos.
"crates/assistant_tools/src/web_search_tool.rs",
# Suppress false positives in database schema.
"crates/collab/migrations/20251208000000_test_schema.sql",
# Vendored JSON schemas from SchemaStore.
"crates/json_schema_store/src/schemas/",
# Not our typos.
"crates/livekit_api/",
# Vim makes heavy use of partial typing tables.
"crates/vim/",
# Editor, file finder, and fuzzy matching rely on partial typing and custom in-string syntax.
"crates/file_finder/src/file_finder_tests.rs",
"crates/fuzzy_nucleo/src/strings.rs",
"crates/editor/src/editor_tests.rs",
"crates/editor/src/edit_prediction_tests.rs",
# There are some names in the test data that are incorrectly flagged as typos.
"crates/git/test_data/blame_incremental_complex",
"crates/git/test_data/golden/blame_incremental_complex.json",
# We have some base64-encoded data that is incorrectly being flagged.
"crates/rpc/src/auth.rs",
# glsl isn't recognized by this tool.
"extensions/glsl/languages/glsl/",
# Protols is the name of the language server.
"extensions/proto/extension.toml",
"extensions/proto/src/language_servers/protols.rs",
# Windows likes its abbreviations.
"crates/gpui_windows/src/directx_renderer.rs",
"crates/gpui_windows/src/events.rs",
"crates/gpui_windows/src/direct_write.rs",
"crates/gpui_windows/src/window.rs",
# Some typos in the base mdBook CSS.
"docs/theme/css/",
# Automatically generated JS.
"docs/theme/c15t@*.js",
# Spellcheck triggers on `|Fixe[sd]|` regex part.
"script/danger/dangerfile.ts",
# File type extensions are not typos
"crates/zed/resources/windows/zed.iss",
# typos-cli doesn't understand our `vˇariable` markup
"crates/editor/src/hover_links.rs",
# typos-cli doesn't understand `setis` is intentional test case
"crates/editor/src/code_completion_tests.rs",
# Linux repository structure is not a valid text, hence we should not check it for typos
"crates/project_panel/benches/linux_repo_snapshot.txt",
# Some multibuffer test cases have word fragments that register as typos
"crates/multi_buffer/src/multi_buffer_tests.rs",
# Macos apis
"crates/gpui_macos/src/dispatcher.rs",
# Tests contain partially incomplete words (by design)
"crates/edit_prediction_cli/src/split_commit.rs",
"crates/edit_prediction_metrics/src/kept_rate.rs",
# Eval examples contain intentionally partial words (e.g. "secur" for "secure")
"crates/edit_prediction_cli/evals/",
# Tests contain `baˇr` that cause `"ba" should be "by" or "be".`-like false-positives
"crates/editor/src/document_symbols.rs",
]
[default]
extend-ignore-re = [
# PNG is a file format, not a typo
"PNG",
'cl\[ist]',
'\[lan\]guage',
'"ba"',
"doas",
# ProtoLS crate with tree-sitter Protobuf grammar.
"protols",
# x11rb SelectionNotifyEvent struct field
"requestor",
# macOS version
"Big Sur",
# Not an actual typo but an intentionally invalid color, in `color_extractor`
"#fof",
# Stripped version of reserved keyword `type`
"typ",
# AMD GPU Services
"ags",
# AMD GPU Services
"AGS",
# "noet" is a vim variable (ideally to ignore locally)
"noet",
# Yarn Plug'n'Play
"PnP",
# `image` crate method: Delay::from_numer_denom_ms
"numer",
# Abbreviation for foreignObject in mermaid SVG processing
"fo",
# Mermaid CSS class name for state diagram composites
"composit",
# Used in truncating tests to ensure byte-length vs char like in café
"caf…"
]
check-filename = true