Skip to main content
Glama

retrieve_knowledge

Query DevBrain to extract relevant developer knowledge, articles, and resources. Use tags like 'ios' or 'react-native' to refine search results and access title, description, and URLs for further reading.

Instructions

Queries DevBrain (aka developers brain` system) and returns relevant information.

Args: query: The question or ask to query for knowledge. tags: Optional comma-separated list of tags (keywords) to filter or ground the search. (e.g.: ios, ios,SwiftUI, react-native, web, web,react, fullstack,react-native,flutter). Do not provide more than 3 words.

Returns: str: Helpful knowledge and context information from DevBrain (articles include title, short description and a URL to the full article to read it later).

Input Schema

NameRequiredDescriptionDefault
queryYes
tagsNo

Input Schema (JSON Schema)

{ "properties": { "query": { "title": "Query", "type": "string" }, "tags": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Tags" } }, "required": [ "query" ], "type": "object" }

Implementation Reference

  • The core handler function for the 'retrieve_knowledge' tool. It validates the API token, constructs a POST request to the DevBrain API with the query and optional tags, and returns the response text or an error message.
    def retrieve_knowledge(query: str, tags: str | None = None) -> str: """Queries DevBrain (aka `developer`s brain` system) and returns relevant information. Args: query: The question or ask to query for knowledge. tags: Optional comma-separated list of tags (keywords) to filter or ground the search. (e.g.: `ios`, `ios,SwiftUI`, `react-native`, `web`, `web,react`, `fullstack,react-native,flutter`). Do not provide more than 3 words. Returns: str: Helpful knowledge and context information from DevBrain (articles include title, short description and a URL to the full article to read it later). """ token_error = _enforce_token() if token_error: return token_error url = f"{api_host_base}/newsletter/find" headers = { "authorization": f"Bearer {_token}", "content-type": "application/json", } data = {"q": query} if tags: data["tags"] = tags try: response = requests.post(url, headers=headers, json=data) response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx) return response.text except requests.exceptions.RequestException: return "No related knowledge at this time for this search query. API error occurred - DevBrain knowledge base service is temporarily unavailable."
  • The @mcp_server.tool decorator registers the retrieve_knowledge function as an MCP tool.
    @mcp_server.tool
  • Helper function used by retrieve_knowledge to ensure the API token is set, retrieving it from environment if necessary.
    def _enforce_token() -> str | None: global _token if _token is None: _token = os.getenv("API_TOKEN") if _token is None: return "Token not set. You need to set `API_TOKEN` environment variable." return None
  • The function signature and docstring define the input schema (query: str required, tags: str|None optional) and output (str), used by FastMCP for tool schema.
    def retrieve_knowledge(query: str, tags: str | None = None) -> str: """Queries DevBrain (aka `developer`s brain` system) and returns relevant information. Args: query: The question or ask to query for knowledge. tags: Optional comma-separated list of tags (keywords) to filter or ground the search. (e.g.: `ios`, `ios,SwiftUI`, `react-native`, `web`, `web,react`, `fullstack,react-native,flutter`). Do not provide more than 3 words. Returns: str: Helpful knowledge and context information from DevBrain (articles include title, short description and a URL to the full article to read it later). """

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/mimeCam/mcp-devbrain-stdio'

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