| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
|
||
| The Context object gives your tools and resources access to MCP capabilities: | ||
|
|
||
| <!-- snippet-source examples/servers/everything/src/everything/server.py#L43-L58 --> |
There was a problem hiding this comment.
this is only one example for this PR, when we agree on the process, will replace the rest of the Server examples (and later client) in README as separate PRs
Sorry, something went wrong.
There was a problem hiding this comment.
Neat!!
Sorry, something went wrong.
| severity="high", | ||
| title="Heat Wave Warning", | ||
| description="Temperatures expected to exceed 40°C", | ||
| description="Temperatures expected to exceed 40 degrees", |
There was a problem hiding this comment.
nit: revert to celsius to avoid frowns from US users?
Sorry, something went wrong.
| # In check mode, only check if code has changed | ||
| if check_mode: | ||
| # Extract existing code from the match | ||
| existing_content = match.group(5) |
There was a problem hiding this comment.
move up w/ the others?
Sorry, something went wrong.
| # Build the replacement block | ||
| replacement = f"""{indent}<!-- snippet-source {file_path}{line_ref} --> | ||
| {indent}```python | ||
| {code} |
There was a problem hiding this comment.
Might want to indent the code here too {indent}{code.replace('\n', f'\n{indent}')} (markdown should remove it)
Sorry, something went wrong.
| from typing import Literal | ||
|
|
||
| # Available snippet modules | ||
| SNIPPET_MODULES = [ |
There was a problem hiding this comment.
Given you're not using the #line syntax, i wonder if you could just get the list of snippets on the fly from readme parser, avoid checking in these generated files / evaluate them on the fly (maybe create a temp directory, add it to the PYTHONPATH programmatically and load adhoc $tmp/snippet$i.py modules?)
(would also remove the need for a file name)
Sorry, something went wrong.
There was a problem hiding this comment.
As mentioned on Discord, I don't think this will provide a good experience for readers.
We should have a setup in place where every example is an MRE in the documentation.
For inspiration, FastAPI and PydanticAI (popular python projects) have already this kind of setup in their repositories - although their setup is for the MkDocs, not for the README.
Sorry, something went wrong.
@Kludex, the examples are now all standalone files, what am I missing? |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
We already had an integration test that verifies all current functionality works as expected, so we can use it as both a server example and as the source for README snippets. These snippets will be automatically updated and verified through CI checks. In the future, we'll also add an everything client example and include it in both the README and integration tests.