get_example MCP tool and its CLI counterpart npx githits@latest example accept a plain-language query and return an implementation example with source citations.
Code Examples are not version-aware. Use Code Navigation when your agent needs to inspect a specific package version or repository ref.
How agents use it
Your agent callsget_example automatically when it is stuck on an unfamiliar API, needs to validate a pattern, or encounters an error it cannot resolve from training data. You do not need to prompt it manually — once GitHits is connected via MCP, the agent decides when to reach for the tool.
You can also trigger it explicitly from the CLI for manual research or to give your agent a head start with fresh context:
--lang to force a language and --license to choose the license filter. The MCP parameters are named language and license_mode.
Parameters
Natural-language description of the code pattern or API usage you need. Write it the way you would describe the problem to a colleague — for example,
"broadcast messages to specific rooms using python-socketio with Redis as the message queue backend".Programming language to target. Omit this parameter and GitHits infers the language from your query automatically. Only supply it when you need to force a specific language and want to be exact. If you are unsure of the canonical name, use
npx githits@latest languages first (see below).Controls license filtering for Code Examples only. Use
strict by default, yolo for unfiltered research, or custom for your configured blocklist at githits.com.Example output
The following query asks for a Python Redis pub/sub pattern. GitHits returns an implementation example alongside citations showing where that prior art appears in the open-source ecosystem.- An implementation example based on real-world usage
- Source repository citations (e.g.,
socketio/socket.io-redis-adapter,miguelgrinberg/python-socketio) - A
solution_idon the final line of the output, used when submitting feedback
Results are useful for current ecosystem patterns, not for version-pinned dependency inspection.
Language support
get_example supports over 800 programming languages. In most cases, GitHits infers the correct language from your query without any additional input.
When you need to force a specific language and are unsure of the exact name GitHits expects, use the search_language tool or npx githits@latest languages command to look it up:
Submitting feedback
After reviewing an example, submit feedback with thesolution_id from the output. See Feedback for the full tool reference.
MCP tool reference
| Tool | CLI command | Purpose |
|---|---|---|
get_example | npx githits@latest example | Natural-language search returning an implementation example |
search_language | npx githits@latest languages | List or filter supported language names |