Skip to content

Unique tool desc created in mcp tools to allow multiple tool integrations. #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 40 additions & 7 deletions src/mcp_server_rememberizer/server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import logging
import os
import sys

import mcp.server.stdio
import mcp.types as types
Expand Down Expand Up @@ -33,7 +34,23 @@
client = APIClient(base_url=REMEMBERIZER_BASE_URL, api_key=REMEMBERIZER_API_TOKEN)


# Get the current process ID
PROCESS_ID = os.getpid()

def enhance_description(base_description: str) -> str:
"""Enhance a tool description by appending the process ID.

Args:
base_description: The original hardcoded description

Returns:
Enhanced description with process ID appended
"""
return f"{base_description}\n\nProcess ID: {PROCESS_ID}"


async def serve() -> Server:
# No pre-loading or logging needed
server = Server(APP_NAME)

@server.list_resources()
Expand Down Expand Up @@ -65,17 +82,27 @@ async def read_resource(uri: AnyUrl) -> str:

@server.list_tools()
async def list_tools() -> list[types.Tool]:
# Get base descriptions
account_info_desc = "Get information about your Rememberizer.ai personal/team knowledge repository account. This includes account holder name and email address."

# Enhance the description with process ID
enhanced_account_info_desc = enhance_description(account_info_desc)

return [
types.Tool(
name=RememberizerTools.ACCOUNT_INFORMATION.value,
description="Get information about your Rememberizer.ai personal/team knowledge repository account. This includes account holder name and email address.",
description=enhanced_account_info_desc,
inputSchema={
"type": "object",
},
),
types.Tool(
name=RememberizerTools.SEARCH.value,
description="Send a block of text and retrieve cosine similar matches from your connected Rememberizer personal/team internal knowledge and memory repository.",
description=enhance_description(
"""Send a block of text and retrieve cosine similar matches from your connected Rememberizer personal/team internal knowledge and memory repository.

Consider using the tool list_internal_knowledge_systems to find out what sources of knowledge are available. You can specify a from_datetime_ISO8601 and a to_datetime_ISO8601, and you should look at the context of your request to make sure you put reasonable parameters around this by, for example, converting a reference to recently to a start date two weeks before today, or converting yesterday to a timeframe during the last day. But do be aware of the effect of time zone differences in the source data and for the requestor."""
),
inputSchema={
"type": "object",
"properties": {
Expand Down Expand Up @@ -113,7 +140,9 @@ async def list_tools() -> list[types.Tool]:
),
types.Tool(
name=RememberizerTools.AGENTIC_SEARCH.value,
description="Search for documents in Rememberizer in its personal/team internal knowledge and memory repository using a simple query that returns the results of an agentic search. The search may include sources such as Slack discussions, Gmail, Dropbox documents, Google Drive documents, and uploaded files. Consider using the tool list_internal_knowledge_systems to find out which are available. Use the tool list_internal_knowledge_systems to find out which sources are available. \n\nYou can specify a from_datetime_ISO8601 and a to_datetime_ISO8601, and you should look at the context of your request to make sure you put reasonable parameters around this by, for example, converting a reference to recently to a start date two weeks before today, or converting yesterday to a timeframe during the last day. But do be aware of the effect of time zone differences in the source data and for the requestor.",
description=enhance_description(
"Search for documents in Rememberizer in its personal/team internal knowledge and memory repository using a simple query that returns the results of an agentic search. The search may include sources such as Slack discussions, Gmail, Dropbox documents, Google Drive documents, and uploaded files. Consider using the tool list_internal_knowledge_systems to find out which are available. Use the tool list_internal_knowledge_systems to find out which sources are available. \n\nYou can specify a from_datetime_ISO8601 and a to_datetime_ISO8601, and you should look at the context of your request to make sure you put reasonable parameters around this by, for example, converting a reference to recently to a start date two weeks before today, or converting yesterday to a timeframe during the last day. But do be aware of the effect of time zone differences in the source data and for the requestor."
),
inputSchema={
"type": "object",
"properties": {
Expand Down Expand Up @@ -159,22 +188,26 @@ async def list_tools() -> list[types.Tool]:
),
types.Tool(
name=RememberizerTools.LIST_INTEGRATIONS.value,
description="List the sources of personal/team internal knowledge. These may include Slack discussions, Gmail, Dropbox documents, Google Drive documents, and uploaded files.",
description=enhance_description(
"List the sources of personal/team internal knowledge. These may include Slack discussions, Gmail, Dropbox documents, Google Drive documents, and uploaded files."
),
inputSchema={
"type": "object",
},
),
types.Tool(
name=RememberizerTools.LIST_DOCUMENTS.value,
description="""Retrieves a paginated list of all documents in your personal/team knowledge system. Sources could include Slack discussions, Gmail, Dropbox documents, Google Drive documents, and uploaded files. Consider using the tool list_internal_knowledge_systems to find out which are available.
description=enhance_description(
"""Retrieves a paginated list of all documents in your personal/team knowledge system. Sources could include Slack discussions, Gmail, Dropbox documents, Google Drive documents, and uploaded files. Consider using the tool list_internal_knowledge_systems to find out which are available.

Use this tool to browse through available documents and their metadata.

Examples:
- List first 100 documents: {"page": 1, "page_size": 100}
- Get next page: {"page": 2, "page_size": 100}
- Get maximum allowed documents: {"page": 1, "page_size": 1000}
""",
"""
),
inputSchema={
"type": "object",
"properties": {
Expand All @@ -196,7 +229,7 @@ async def list_tools() -> list[types.Tool]:
),
types.Tool(
name=RememberizerTools.MEMORIZE.value,
description=(
description=enhance_description(
"Save a piece of text information in your Rememberizer.ai knowledge system so that it "
"may be recalled in future through tools retrieve_semantically_similar_internal_knowledge or "
"smart_search_internal_knowledge."
Expand Down