Skip to main content
Glama
GongRzhe

Langflow Document Q&A Server

query_docs

Search documents using natural language questions to find specific information within your Langflow Q&A system.

Instructions

Query the document Q&A system with a prompt

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe query prompt to search for in the documents

Implementation Reference

  • src/index.ts:53-68 (registration)
    Registration of the 'query_docs' tool including its name, description, and input schema in the ListToolsRequestSchema handler.
        {
          name: 'query_docs',
          description: 'Query the document Q&A system with a prompt',
          inputSchema: {
            type: 'object',
            properties: {
              query: {
                type: 'string',
                description: 'The query prompt to search for in the documents',
              },
            },
            required: ['query'],
          },
        },
      ],
    }));
  • Input schema definition for the 'query_docs' tool.
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'The query prompt to search for in the documents',
          },
        },
        required: ['query'],
      },
    },
  • Handler for CallToolRequestSchema that implements the 'query_docs' tool by checking the tool name and making an API call to the document Q&A endpoint with the query, returning the response text.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      if (request.params.name !== 'query_docs') {
        throw new McpError(
          ErrorCode.MethodNotFound,
          `Unknown tool: ${request.params.name}`
        );
      }
    
      const { query } = request.params.arguments as { query: string };
    
      try {
        const response = await axios.post<QueryResponse>(
          this.apiEndpoint,
          {
            input_value: query,
            output_type: 'chat',
            input_type: 'chat',
            tweaks: {
              'ChatInput-Jrzyb': {},
              'ChatOutput-rzoZb': {},
              'ParseData-hzL7Q': {},
              'File-2Teuj': {},
              'Prompt-ktajI': {},
              'MistralModel-aLZcw': {}
            }
          },
          {
            headers: {
              'Content-Type': 'application/json',
            },
            params: {
              stream: false,
            },
          }
        );
    
        const result = response.data.outputs[0].outputs[0].results.message.text;
    
        return {
          content: [
            {
              type: 'text',
              text: result,
            },
          ],
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new McpError(
            ErrorCode.InternalError,
            `API request failed: ${error.message}`
          );
        }
        throw error;
      }
    });
Install Server

Other 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/GongRzhe/Langflow-DOC-QA-SERVER'

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