to_mcp_tool_result#
- scikitplot.corpus.to_mcp_tool_result(documents, *, tool_name='corpus_search', is_error=False)[source]#
Format documents as an MCP
tools/callresponse.- Parameters:
- documentsSequence[CorpusDocument]
Search results.
- tool_namestr, optional
Name of the MCP tool that produced these results.
- is_errorbool, optional
Whether this response represents an error.
- Returns:
- dict[str, Any]
MCP tool result with
contentarray andisErrorflag.
- Parameters:
- Return type:
Notes
User note: Return this from your MCP server’s
tools/callhandler:@server.tool("corpus_search") async def search(query: str) -> dict: results = builder.search(query) return to_mcp_tool_result([r.doc for r in results])
Gallery examples#
corpus WHO European Region local or url per file with examples
corpus WHO European Region local or url per file with examples