Skip to main content
Glama

docs_ask

Get answers to Hedera blockchain questions with code examples and citations. Adjust responses for beginner, intermediate, or advanced expertise levels.

Instructions

Answer ANY knowledge question about Hedera using RAG.

HANDLES: Conceptual (what is X?), how-to (how do I?), comparison (X vs Y), troubleshooting, best practices, architecture, security RETURNS: Comprehensive answer with code examples and source citations EXPERTISE: Adjustable for beginner/intermediate/advanced levels

USE FOR: Learning Hedera concepts, getting implementation guidance, understanding best practices. THIS IS YOUR PRIMARY TOOL FOR HEDERA KNOWLEDGE QUESTIONS.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionYesQuestion about Hedera
expertiseLevelNoUser expertise level
includeCodeExamplesNoInclude code in answer
languageNoPreferred language for examples

Implementation Reference

  • The main execution handler for the 'docs_ask' tool. Initializes RAG services, processes the question with intent detection, retrieves answer from ragService, formats response with sources and metadata.
    export async function docsAsk(args: {
      question: string;
      includeCodeExamples?: boolean;
      language?: string;
      contentType?: string;
      queryIntent?: string;
      expertiseLevel?: string;
    }) {
      try {
        const services = await initializeRAGServices();
    
        if (!services) {
          throw new Error('RAG services not initialized');
        }
    
        // Build filters
        const filters: any = {};
        if (args.contentType) filters.contentType = args.contentType;
    
        // Auto-detect intent if not provided
        const detectedIntent = args.queryIntent || services.ragService.classifyQueryIntent(args.question);
        const expertiseLevel = args.expertiseLevel || 'intermediate';
    
        logger.info('Processing docs_ask with intent detection', {
          question: args.question.substring(0, 100),
          detectedIntent,
          providedIntent: args.queryIntent,
          expertiseLevel,
        });
    
        // Ask question with intent awareness
        const answer = await services.ragService.askQuestionWithIntent(args.question, {
          filters: Object.keys(filters).length > 0 ? filters : undefined,
          includeCodeExamples: args.includeCodeExamples || false,
          language: args.language,
          queryIntent: detectedIntent as any,
          expertiseLevel: expertiseLevel as any,
        });
    
        // Format response with enhanced metadata
        const response = {
          question: args.question,
          detectedIntent,
          expertiseLevel,
          answer: answer.answer,
          sources: answer.sources.map(source => ({
            title: source.title,
            url: source.url,
            relevance: Math.round(source.score * 100) / 100,
          })),
          hasCodeExamples: answer.hasCodeExamples,
          model: answer.model,
        };
    
        // Format sources as a readable list at the bottom
        const sourcesSection = answer.sources.length > 0
          ? '\n\n---\n**Sources:**\n' + answer.sources.map((source, i) =>
              `${i + 1}. [${source.title}](${source.url}) (relevance: ${Math.round(source.score * 100)}%)`
            ).join('\n') + '\n\n*Answered by HashPilot RAG System*'
          : '\n\n*Answered by HashPilot RAG System*';
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response, null, 2) + sourcesSection,
            },
          ],
        };
      } catch (error: any) {
        logger.error('docs_ask failed', { error: error.message });
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Tool definition including name, detailed description, and comprehensive input schema for 'docs_ask'.
    export const docsAskTool = {
      name: 'docs_ask',
      description: 'Answer ANY knowledge-based question about Hedera Network and ecosystem. Handles: conceptual questions (what is Hedera Consensus Service?), how-to questions (how to create tokens?), comparison questions (Hedera vs Ethereum, HTS vs ERC-20), best practices (security recommendations, gas optimization), troubleshooting (why did transaction fail?), architecture queries (how does hashgraph consensus work?), use case guidance (is Hedera suitable for my DeFi app?), security questions (auditing smart contracts), migration help (moving from Ethereum), SDK usage questions, network configuration, fee structures, staking mechanics, and any educational/learning questions. Returns AI-generated answers with source citations from official Hedera documentation, SDKs, HIPs, and tutorials. USE THIS TOOL FOR ALL QUESTIONS ABOUT HEDERA THAT DO NOT REQUIRE EXECUTING AN ACTION ON THE BLOCKCHAIN.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          question: {
            type: 'string',
            description: 'Any question about Hedera in natural language. Can be conceptual, technical, comparative, or practical.',
          },
          includeCodeExamples: {
            type: 'boolean',
            description: 'Include code examples in the answer when relevant',
            default: false,
          },
          language: {
            type: 'string',
            enum: ['javascript', 'typescript', 'java', 'python', 'go', 'solidity'],
            description: 'Preferred programming language for code examples',
          },
          contentType: {
            type: 'string',
            enum: ['tutorial', 'api', 'concept', 'example', 'guide', 'reference'],
            description: 'Filter sources by content type',
          },
          queryIntent: {
            type: 'string',
            enum: ['conceptual', 'how_to', 'comparison', 'troubleshooting', 'best_practices', 'use_case', 'architecture', 'migration', 'security', 'general'],
            description: 'Intent of the question to provide more targeted answers: conceptual (explain X), how_to (steps to do Y), comparison (X vs Y), troubleshooting (fix error), best_practices (recommendations), use_case (suitability check), architecture (system design), migration (platform transition), security (safety/audits), general (default)',
          },
          expertiseLevel: {
            type: 'string',
            enum: ['beginner', 'intermediate', 'advanced'],
            description: 'User expertise level to adjust answer complexity and detail',
            default: 'intermediate',
          },
        },
        required: ['question'],
      },
    };
  • src/index.ts:343-371 (registration)
    The 'docs_ask' tool is registered in the main tool definitions array used by the MCP server for listing tools.
      {
        name: 'docs_ask',
        description: `Answer ANY knowledge question about Hedera using RAG.
    
    HANDLES: Conceptual (what is X?), how-to (how do I?), comparison (X vs Y), troubleshooting, best practices, architecture, security
    RETURNS: Comprehensive answer with code examples and source citations
    EXPERTISE: Adjustable for beginner/intermediate/advanced levels
    
    USE FOR: Learning Hedera concepts, getting implementation guidance, understanding best practices.
    THIS IS YOUR PRIMARY TOOL FOR HEDERA KNOWLEDGE QUESTIONS.`,
        inputSchema: {
          type: 'object' as const,
          properties: {
            question: { type: 'string', description: 'Question about Hedera' },
            expertiseLevel: {
              type: 'string',
              enum: ['beginner', 'intermediate', 'advanced'],
              description: 'User expertise level',
            },
            includeCodeExamples: { type: 'boolean', description: 'Include code in answer' },
            language: {
              type: 'string',
              enum: ['javascript', 'typescript', 'java', 'python', 'go', 'solidity'],
              description: 'Preferred language for examples',
            },
          },
          required: ['question'],
        },
      },
  • src/index.ts:622-623 (registration)
    The main request handler dispatches calls to 'docs_ask' by invoking the imported docsAsk function.
    case 'docs_ask':
      result = await docsAsk(args as any);
  • src/index.ts:51-51 (registration)
    Import of the docsAsk handler function from the rag module.
    import { docsSearch, docsAsk, docsGetExample, codeGenerate } from './tools/rag.js';
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it uses RAG (Retrieval-Augmented Generation), handles various question types (conceptual, how-to, etc.), returns comprehensive answers with code examples and citations, and adjusts for expertise levels. However, it doesn't mention potential limitations like response time, accuracy constraints, or data freshness.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (HANDLES, RETURNS, EXPERTISE, USE FOR) and front-loaded with the core purpose. However, the final sentence ('THIS IS YOUR PRIMARY TOOL...') is somewhat redundant with the USE FOR section, and the description could be slightly more concise by combining related points.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a knowledge Q&A tool with no annotations and no output schema, the description provides good contextual completeness. It covers purpose, usage, capabilities, and return format. The main gap is the lack of output schema, but the description compensates by detailing what the tool returns (comprehensive answers with code examples and citations). It could be more complete by mentioning response format or potential errors.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters thoroughly. The description adds some context by mentioning 'expertise level' and 'code examples' in the RETURNS and EXPERTISE sections, but doesn't provide additional semantic meaning beyond what's in the schema descriptions. This meets the baseline of 3 when schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Answer ANY knowledge question about Hedera using RAG.' It specifies the verb ('Answer'), resource ('knowledge question about Hedera'), and method ('using RAG'), distinguishing it from sibling tools like docs_search or error_explain that likely serve different functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: 'USE FOR: Learning Hedera concepts, getting implementation guidance, understanding best practices. THIS IS YOUR PRIMARY TOOL FOR HEDERA KNOWLEDGE QUESTIONS.' It clearly defines when to use this tool (for knowledge questions) versus alternatives like code_generate or account_balance, and lists specific question types it handles.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/justmert/hashpilot'

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