Skip to main content
Glama
PancrePal-xiaoyibao

Get笔记 MCP Server

knowledge_search

Search your Get笔记 knowledge base using AI-enhanced queries to find processed answers, with support for follow-up questions through conversation history.

Instructions

在Get笔记知识库中进行AI增强搜索,返回经过深度处理的答案。支持对话历史追问。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionYes要搜索的问题
topic_idsNo知识库ID列表(当前只支持1个)。如果配置了GET_BIJI_DEFAULT_TOPIC_ID环境变量,可省略此参数
deep_seekYes是否启用深度思考
refsNo是否返回引用来源
historyNo对话历史,用于追问场景

Implementation Reference

  • Core handler function that implements the knowledge_search tool logic: applies rate limiting, handles default topic_ids, makes HTTP POST to '/knowledge/search' API, and processes errors.
    async knowledgeSearch(params: KnowledgeSearchRequest): Promise<any> {
      await this.rateLimiter.waitForSlot();
    
      // 如果没有提供topic_ids且配置了默认topic_id,则使用默认值
      if (!params.topic_ids || params.topic_ids.length === 0) {
        if (this.config.defaultTopicId) {
          params.topic_ids = [this.config.defaultTopicId];
          logger.debug('Using default topic_id', { topic_id: this.config.defaultTopicId });
        } else {
          throw new Error('topic_ids is required or set GET_BIJI_DEFAULT_TOPIC_ID in environment');
        }
      }
    
      try {
        const response = await this.client.post('/knowledge/search', params);
        return response.data;
      } catch (error: any) {
        const errorMsg = error.response?.data?.h?.e || error.message;
        const statusCode = error.response?.status;
        
        logger.error('Knowledge search failed', { 
          error: errorMsg, 
          statusCode,
          params: { ...params, topic_ids: params.topic_ids },
          responseData: error.response?.data 
        });
        
        if (statusCode === 403) {
          throw new Error(`Knowledge search failed: Authentication error (403). Please check your GET_BIJI_API_KEY is valid.`);
        }
        
        throw new Error(`Knowledge search failed: ${errorMsg}`);
      }
    }
  • MCP server tool execution handler for 'knowledge_search': parses arguments, calls client.knowledgeSearch, and returns JSON-formatted result as text content.
    case 'knowledge_search': {
      const { question, topic_ids, deep_seek, refs, history } = args as {
        question: string;
        topic_ids?: string[];
        deep_seek: boolean;
        refs?: boolean;
        history?: ChatMessage[];
      };
    
      const result = await client.knowledgeSearch({
        question,
        topic_ids,
        deep_seek,
        refs,
        history,
      });
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:38-78 (registration)
    Tool registration in MCP server's tools list: defines name 'knowledge_search', description, and input schema for validation.
    {
      name: 'knowledge_search',
      description: '在Get笔记知识库中进行AI增强搜索,返回经过深度处理的答案。支持对话历史追问。',
      inputSchema: {
        type: 'object',
        properties: {
          question: {
            type: 'string',
            description: '要搜索的问题',
          },
          topic_ids: {
            type: 'array',
            items: { type: 'string' },
            description: '知识库ID列表(当前只支持1个)。如果配置了GET_BIJI_DEFAULT_TOPIC_ID环境变量,可省略此参数',
          },
          deep_seek: {
            type: 'boolean',
            description: '是否启用深度思考',
            default: true,
          },
          refs: {
            type: 'boolean',
            description: '是否返回引用来源',
            default: false,
          },
          history: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                content: { type: 'string' },
                role: { type: 'string', enum: ['user', 'assistant'] },
              },
              required: ['content', 'role'],
            },
            description: '对话历史,用于追问场景',
          },
        },
        required: ['question', 'deep_seek'],
      },
    },
  • TypeScript type definition for KnowledgeSearchRequest interface, matching the tool's input schema, used in client code.
    export interface KnowledgeSearchRequest {
      question: string;
      topic_ids?: string[];  // 可选,如果配置了defaultTopicId
      deep_seek: boolean;
      refs?: boolean;
      history?: ChatMessage[];
    }

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/PancrePal-xiaoyibao/get_biji_mcp'

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