Skip to main content
Glama
GongRzhe

Langflow Document Q&A Server

query_docs

Search and retrieve answers from documents using natural language queries with a Langflow-powered 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

  • Request handler for CallToolRequestSchema implementing the 'query_docs' tool logic: checks tool name, extracts query, POSTs to API endpoint, extracts text from response, returns as MCP content block, handles axios errors.
    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; } }); }
  • Input schema definition for 'query_docs' tool: object with required 'query' string property.
    inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'The query prompt to search for in the documents', }, }, required: ['query'], },
  • src/index.ts:51-68 (registration)
    Registers 'query_docs' tool via ListToolsRequestHandler: specifies name, description, and inputSchema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { 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'], }, }, ], }));
  • Type interface QueryResponse for typing the API response structure used in the handler.
    interface QueryResponse { outputs: Array<{ outputs: Array<{ results: { message: { text: string; }; }; }>; }>; }

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

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