Skip to main content
Glama
marianfoo

SAP Documentation MCP Server

by marianfoo

sap_community_search

Search SAP Community for blog posts, discussions, and solutions to troubleshoot technical issues using error codes and specific scenarios.

Instructions

SEARCH SAP COMMUNITY: sap_community_search(query="search terms")

FUNCTION NAME: sap_community_search (or mcp_sap-docs-remote_sap_community_search)

FINDS: Blog posts, discussions, solutions from SAP Community INCLUDES: Engagement data (kudos), ranked by "Best Match"

TYPICAL WORKFLOW:

  1. sap_community_search(query="your problem + error code")

  2. fetch(id="community-12345") for full posts

BEST FOR TROUBLESHOOTING: • Include error codes: "415 error", "500 error" • Be specific: "CAP action binary upload 415" • Use real scenarios: "wizard implementation issues"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch terms for SAP Community. Include error codes and specific technical details.

Implementation Reference

  • Registration of the sap_community_search tool including its name, detailed description, and input schema definition.
              {
                name: "sap_community_search", 
                description: `SEARCH SAP COMMUNITY: sap_community_search(query="search terms")
    
    FUNCTION NAME: sap_community_search (or mcp_sap-docs-remote_sap_community_search)
    
    FINDS: Blog posts, discussions, solutions from SAP Community
    INCLUDES: Engagement data (kudos), ranked by "Best Match"
    
    TYPICAL WORKFLOW:
    1. sap_community_search(query="your problem + error code")
    2. fetch(id="community-12345") for full posts
    
    BEST FOR TROUBLESHOOTING:
    • Include error codes: "415 error", "500 error"
    • Be specific: "CAP action binary upload 415"
    • Use real scenarios: "wizard implementation issues"`,
                inputSchema: {
                  type: "object",
                  properties: {
                    query: {
                      type: "string",
                      description: "Search terms for SAP Community. Include error codes and specific technical details.",
                      examples: [
                        "CAP action parameter binary file upload 415 error",
                        "wizard implementation best practices",
                        "fiori elements authentication",
                        "UI5 deployment issues",
                        "wdi5 test automation problems"
                      ]
                    }
                  },
                  required: ["query"]
                }
              },
  • Input schema definition for the sap_community_search tool, specifying the required 'query' parameter with description and examples.
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search terms for SAP Community. Include error codes and specific technical details.",
          examples: [
            "CAP action parameter binary file upload 415 error",
            "wizard implementation best practices",
            "fiori elements authentication",
            "UI5 deployment issues",
            "wdi5 test automation problems"
          ]
        }
      },
      required: ["query"]
    }
  • Core handler logic for executing sap_community_search: extracts query, calls searchCommunity helper, transforms results to standardized format, logs performance, handles errors and returns structured JSON response.
    if (name === "sap_community_search") {
      const { query } = args as { query: string };
      
      // Enhanced logging with timing
      const timing = logger.logToolStart(name, query, clientMetadata);
      
      try {
        const res: SearchResponse = await searchCommunity(query);
        
        if (!res.results.length) {
          logger.logToolSuccess(name, timing.requestId, timing.startTime, 0);
          return createErrorResponse(
            res.error || `No SAP Community posts found for "${query}". Try different keywords or check your connection.`,
            timing.requestId
          );
        }
        
        // Transform community search results to ChatGPT-compatible format
        const communityResults: SearchResult[] = res.results.map((r: any, index) => ({
          // ChatGPT-required format: id, title, url
          id: r.id || `community-${index}`,
          title: r.title || 'SAP Community Post',
          url: r.url || `#${r.id}`,
          // Additional fields for enhanced functionality
          library_id: r.library_id || `community-${index}`,
          topic: r.topic || '',
          snippet: r.snippet || (r.description ? r.description.substring(0, 200) + '...' : ''),
          score: r.score || 0,
          metadata: r.metadata || {
            source: 'sap-community',
            likes: r.likes,
            author: r.author,
            postTime: r.postTime,
            rank: index + 1
          }
        }));
        
        logger.logToolSuccess(name, timing.requestId, timing.startTime, res.results.length);
        
        return createSearchResponse(communityResults);
      } catch (error) {
        logger.logToolError(name, timing.requestId, timing.startTime, error);
        return createErrorResponse(
          `SAP Community search service temporarily unavailable. Please try again later.`,
          timing.requestId
        );
      }
    }
  • Helper function searchCommunity that performs the actual SAP Community search using searchAndGetTopPosts, fetches full post content, formats results with metadata (author, likes, tags), handles errors.
    export async function searchCommunity(query: string): Promise<SearchResponse> {
      try {
        // Use the convenience function to search and get top 3 posts with full content
        const result = await searchAndGetTopPosts(query, 3, {
          includeBlogs: true,
          userAgent: 'SAP-Docs-MCP/1.0'
        });
        
        if (result.search.length === 0) {
          return { 
            results: [], 
            error: `No SAP Community posts found for "${query}". Try different keywords or check your connection.` 
          };
        }
    
        // Format the results with full post content
        let response = `Found ${result.search.length} SAP Community posts for "${query}" with full content:\n\n`;
        response += `🌐 **SAP Community Posts with Full Content:**\n\n`;
    
        for (const searchResult of result.search) {
          const postContent = result.posts[searchResult.postId || ''];
          
          if (postContent) {
            // Add the full post content
            response += postContent + '\n\n';
            response += `---\n\n`;
          } else {
            // Fallback to search result info if full content not available
            const postDate = searchResult.published || 'Unknown';
            response += `### **${searchResult.title}**\n`;
            response += `**Posted:** ${postDate}\n`;
            response += `**Description:** ${searchResult.snippet || 'No description available'}\n`;
            response += `**URL:** ${searchResult.url}\n`;
            response += `**ID:** \`community-${searchResult.postId}\`\n\n`;
            response += `---\n\n`;
          }
        }
    
        response += `💡 **Note:** These results include the full content from ${Object.keys(result.posts).length} SAP Community posts, representing real-world developer experiences and solutions.`;
    
        return { 
          results: result.search.map((searchResult, index) => ({
            library_id: `community-${searchResult.postId || index}`,
            topic: '',
            id: `community-${searchResult.postId || index}`,
            title: searchResult.title,
            url: searchResult.url,
            snippet: searchResult.snippet || '',
            score: 0,
            metadata: {
              source: 'community',
              postTime: searchResult.published,
              author: searchResult.author,
              likes: searchResult.likes,
              tags: searchResult.tags,
              rank: index + 1
            }
          }))
        };
      } catch (error: any) {
        console.error("Error searching SAP Community:", error);
        return { 
          results: [], 
          error: `Error searching SAP Community: ${error?.message || 'Unknown error'}. Please try again later.` 
        };
      }
    } 

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/marianfoo/mcp-sap-docs'

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