-
Notifications
You must be signed in to change notification settings - Fork 316
Add documentation tools #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
def to_dict(self) -> Dict[str, Any]: | ||
return asdict(self) | ||
|
||
def _get_file_priority(file): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shiraayal-tadata is file a Path? a str? missing typing.
# Create documentation tools for the MCP server | ||
# Based on a single file | ||
create_documentation_tools(mcp_server, "README.md") | ||
# Based on a list of files | ||
# create_documentation_tools(mcp_server, ["README.md", "README2.md", "llms.txt"]) | ||
# Based on a directory | ||
# create_documentation_tools(mcp_server, "docs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shiraayal-tadata
First, make this section a bit clearer, it's too dense.
Second, all these options should be explained in the README too, not just here.
It's unclear what happens when I do README.md + README2.md + llms.txt. Will one take precedence? Will all their text just be concatenated? Need a clearer explanation / example
app = FastAPI() | ||
mcp_server = add_mcp_server(app) | ||
|
||
create_documentation_tools(mcp_server, "README.md") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shiraayal-tadata I would expect documentation tools to be a parameter and not a separate function we need to call.
The add_mcp_server()
function takes a FastAPI app and mutates it, and that makes sense because we are not in control of the FastAPI instance.
But we are in control of our own MCP server instance, so there's no need for another mutating function that takes a server instance. We can just add it as a feature to the existing add_mcp_server()
function.
A clearer syntax might be something like this:
app = FastAPI()
add_mcp_server(
app=app,
documentation_tools=create_documentation_tools("README.md")
)
Here, "documentation_tools" is a parameter expecting a set of tools in some format, and "create_documentation_tools" is not mutating any fastMCP instance. It's just a helper function that returns tools.
Describe your changes
Add a function to automatically create
fetch_documentation
tool, helping AI agents work with the API more efficiently.Screenshots of the feature / bugfix
Checklist before requesting a review