get-code-context-exa

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Context (Exa)

代码上下文工具(Exa)

Tool Restriction (Critical)

工具使用限制(重要)

ONLY use
get_code_context_exa
. Do NOT use other Exa tools.
仅可使用
get_code_context_exa
工具,禁止使用其他Exa工具。

Token Isolation (Critical)

Token隔离规则(重要)

Never run Exa in main context. Always spawn Task agents:
  • Agent calls
    get_code_context_exa
  • Agent extracts the minimum viable snippet(s) + constraints
  • Agent deduplicates near-identical results (mirrors, forks, repeated StackOverflow answers) before presenting
  • Agent returns copyable snippets + brief explanation
  • Main context stays clean regardless of search volume
绝不能在主上下文中运行Exa,必须始终生成任务Agent:
  • Agent调用
    get_code_context_exa
    工具
  • Agent提取最精简的必要代码片段及约束条件
  • Agent在展示结果前,需对高度相似的结果(镜像仓库、复刻代码、重复的StackOverflow回答)进行去重
  • Agent返回可直接复制的代码片段及简短说明
  • 无论搜索量多大,主上下文始终保持整洁

When to Use

使用场景

Use this tool for ANY programming-related request:
  • API usage and syntax
  • SDK/library examples
  • config and setup patterns
  • framework "how to" questions
  • debugging when you need authoritative snippets
以下编程相关需求均可使用本工具:
  • API使用方法与语法
  • SDK/库使用示例
  • 配置与搭建模式
  • 框架使用类问题
  • 需要权威代码片段辅助的调试场景

Inputs (Supported)

支持的输入参数

get_code_context_exa
supports:
  • query
    (string, required)
  • tokensNum
    (number, optional; default ~5000; typical range 1000–50000)
get_code_context_exa
支持以下输入:
  • query
    (字符串类型,必填)
  • tokensNum
    (数字类型,可选;默认值约为5000;常用范围1000–50000)

Query Writing Patterns (High Signal)

高精准查询语句编写技巧

To reduce irrelevant results and cross-language noise:
  • Always include the programming language in the query.
    • Example: use "Go generics" instead of just "generics".
  • When applicable, also include framework + version (e.g., "Next.js 14", "React 19", "Python 3.12").
  • Include exact identifiers (function/class names, config keys, error messages) when you have them.
为减少无关结果和跨语言干扰:
  • 查询语句中必须包含编程语言
    • 示例:使用**"Go generics"而非仅用"generics"**。
  • 适用情况下,还需包含框架+版本(例如:"Next.js 14"、"React 19"、"Python 3.12")。
  • 若有明确标识符(函数/类名、配置键、错误信息),请将其加入查询语句。

Dynamic Tuning

Token动态调整策略

Token strategy:
  • Focused snippet needed → tokensNum 1000–3000
  • Most tasks → tokensNum 5000
  • Complex integration → tokensNum 10000–20000
  • Only go larger when necessary (avoid dumping large context)
Token使用策略:
  • 仅需精准代码片段时 → 设置tokensNum为1000–3000
  • 多数常规任务 → 设置tokensNum为5000
  • 复杂集成场景 → 设置tokensNum为10000–20000
  • 仅在必要时增大数值(避免引入过多冗余上下文)

Output Format (Recommended)

推荐的输出格式

Return:
  1. Best minimal working snippet(s) (keep it copy/paste friendly)
  2. Notes on version / constraints / gotchas
  3. Sources (URLs if present in returned context)
Before presenting:
  • Deduplicate similar results and keep only the best representative snippet per approach.
返回内容要求:
  1. 最优最简可运行代码片段(需支持直接复制粘贴使用)
  2. 关于版本、限制条件及注意事项的说明
  3. 来源信息(若返回上下文包含URL则需提供)
在展示结果前:
  • 对相似结果去重,每种实现方式仅保留最具代表性的最佳代码片段。

MCP Configuration

MCP配置

json
{
  "servers": {
    "exa": {
      "type": "http",
      "url": "https://mcp.exa.ai/mcp?tools=get_code_context_exa"
    }
  }
}
json
{
  "servers": {
    "exa": {
      "type": "http",
      "url": "https://mcp.exa.ai/mcp?tools=get_code_context_exa"
    }
  }
}