Skip to content

Commit eb4fcc9

Browse files
committed
feat: enhance docstring rendering with detailed parameter and return descriptions
1 parent e30360a commit eb4fcc9

2 files changed

Lines changed: 42 additions & 2 deletions

File tree

infrastructure/rag/values.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,40 @@ backend:
2222
host: "0.0.0.0"
2323

2424
# Chat simple tool configuration
25+
# The following configuration for the chat_simple tool will render as follows:
26+
# """Send a message to the RAG system and get a simple text response.
27+
28+
# This is the simplest way to interact with the RAG system - just provide a message and get back the answer as plain text.
29+
#
30+
# Parameters
31+
# ----------
32+
# session_id : str
33+
# Unique identifier for the chat session.
34+
# message : str
35+
# The message/question to ask the RAG system.
36+
#
37+
# Returns
38+
# -------
39+
# str
40+
# The answer from the RAG system as plain text.
41+
# """
2542
chatSimpleDescription: "Send a message to the RAG system and get a simple text response.\n\nThis is the simplest way to interact with the RAG system - just provide a message and get back the answer as plain text."
2643
chatSimpleParameterDescriptions:
2744
session_id: "Unique identifier for the chat session."
2845
message: "The message/question to ask the RAG system."
2946
chatSimpleReturns: "The answer from the RAG system as plain text."
3047
chatSimpleNotes: ""
48+
# If you add a Value to chatSimpleNotes e.g. "This tool is best for simple questions that don't require conversation context."
49+
# it will render to:
50+
# Notes
51+
# -----
52+
# This tool is best for simple questions that don't require conversation context.
3153
chatSimpleExamples: ""
54+
# If you add a Value to chatSimpleExamples e.g. "chat_simple(session_id='my-session', message='What is the main topic of the document?')"
55+
# it will render to:
56+
# Examples
57+
# --------
58+
# chat_simple(session_id='my-session', message='What is the main topic of the document?')
3259

3360
# Chat with history tool configuration
3461
chatWithHistoryDescription: "Send a message with conversation history and get structured response.\n\nProvide conversation history as a simple list of dictionaries.\nEach history item should have 'role' (either 'user' or 'assistant') and 'message' keys."

services/mcp-server/src/docstring_system.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,21 @@ def __init__(self, settings: BaseSettings):
2222
self.settings = settings
2323
self._setup_templates()
2424

25-
def render_docstring(self, template_name: str, **kwargs) -> str:
26-
"""Render a docstring using the template."""
25+
def render_docstring(self, template_name: str, **kwargs: dict) -> str:
26+
"""Render a docstring using the template.
27+
28+
Parameters
29+
----------
30+
template_name : str
31+
Name of the template to render
32+
**kwargs : dict
33+
Keyword arguments to pass to the render function of the template
34+
35+
Returns
36+
-------
37+
str
38+
Rendered docstring
39+
"""
2740
return self.template.render(**kwargs)
2841

2942
def _setup_templates(self):

0 commit comments

Comments
 (0)