Skip to main content
Glama

search

Retrieve precise competitive programming knowledge from OI-Wiki by submitting detailed queries about algorithms or techniques, such as finding a graph's minimum spanning tree or managing interval operations.

Instructions

OI Wiki 致力于成为一个免费开放且持续更新的编程竞赛知识整合站点,大家可以在这里获取与竞赛相关的、有趣又实用的知识。本工具能够在 OI-wiki 中搜索相关的知识点。

query 应该比较详细,与要实现的算法/目标相关。比如:“求一个图的最小生成树”,“维护区间加/区间求和”

@ param query 描述要实现的需求

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • main.py:8-17 (handler)
    The handler function for the MCP 'search' tool, decorated with @mcp.tool(). It takes a query string and delegates to the database search method.
    @mcp.tool()
    async def search(query: str):
        """
        OI Wiki 致力于成为一个免费开放且持续更新的编程竞赛知识整合站点,大家可以在这里获取与竞赛相关的、有趣又实用的知识。本工具能够在 OI-wiki 中搜索相关的知识点。
        
        query 应该比较详细,与要实现的算法/目标相关。比如:“求一个图的最小生成树”,“维护区间加/区间求和”
        
        @ param query 描述要实现的需求
        """
        return db.search(query)
  • main.py:8-8 (registration)
    The @mcp.tool() decorator registers the 'search' function as an MCP tool.
    @mcp.tool()
  • main.py:9-9 (schema)
    Function signature defining the input schema: query as str.
    async def search(query: str):
  • The helper search method in OIWikiDB class that performs vector search using Milvus and retrieves the content of the most relevant OI-Wiki document.
    def search(self, query : str) :
        qvectors = list(self._embedding_model.embed([query]))
        results = self._client.search(
            collection_name=self._collection_name, 
            data=qvectors, 
            limit=1,
            output_fields=["path"]
        )
    
        path = os.path.join(self._docs_dir, results[0][0].entity.path)
        with open(path, 'r') as f:
            res = f.read()
    
        return res
  • main.py:6-6 (helper)
    Instantiation of the database instance used by the search tool.
    db = OIWikiDB()
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ShwStone/mcp-oi-wiki'

If you have feedback or need assistance with the MCP directory API, please join our Discord server