Skip to content

Commit b3dc17e

Browse files
authored
Improve context parameter description with detailed guidelines (#18)
1 parent cfa9542 commit b3dc17e

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mcpcat"
3-
version = "0.1.10"
3+
version = "0.1.11"
44
description = "Analytics Tool for MCP Servers - provides insights into MCP tool usage patterns"
55
authors = [
66
{ name = "MCPCat", email = "[email protected]" },

src/mcpcat/modules/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
SESSION_ID_PREFIX = "ses"
44
EVENT_ID_PREFIX = "evt"
55
MCPCAT_API_URL = "https://api.mcpcat.io" # Default API URL for MCPCat events
6-
DEFAULT_CONTEXT_DESCRIPTION = "Describe why you are calling this tool and how it fits into your overall task"
6+
DEFAULT_CONTEXT_DESCRIPTION = "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\""

tests/community/test_community_tool_context.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytest
44

55
from mcpcat import MCPCatOptions, track
6+
from mcpcat.modules.constants import DEFAULT_CONTEXT_DESCRIPTION
67

78
from ..test_utils.community_client import create_community_test_client
89
from ..test_utils.community_todo_server import (
@@ -46,7 +47,7 @@ async def test_context_parameter_injection_enabled(self):
4647
assert context_schema["type"] == "string"
4748
assert (
4849
context_schema["description"]
49-
== "Describe why you are calling this tool and how it fits into your overall task"
50+
== DEFAULT_CONTEXT_DESCRIPTION
5051
)
5152

5253
@pytest.mark.asyncio
@@ -276,7 +277,7 @@ def tool_with_context(context: str, data: str):
276277
context_schema = tool.inputSchema["properties"]["context"]
277278
assert (
278279
context_schema.get("description")
279-
== "Describe why you are calling this tool and how it fits into your overall task"
280+
== DEFAULT_CONTEXT_DESCRIPTION
280281
)
281282

282283
# Should still be in required
@@ -466,7 +467,7 @@ async def test_default_context_description(self):
466467
# Check for default description
467468
add_todo_tool = next(t for t in tools_result if t.name == "add_todo")
468469
context_schema = add_todo_tool.inputSchema["properties"]["context"]
469-
assert context_schema["description"] == "Describe why you are calling this tool and how it fits into your overall task"
470+
assert context_schema["description"] == DEFAULT_CONTEXT_DESCRIPTION
470471

471472
@pytest.mark.asyncio
472473
async def test_custom_context_description_with_multiple_tools(self):

tests/test_tool_context.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from mcp.types import Tool
77

88
from mcpcat import MCPCatOptions, track
9+
from mcpcat.modules.constants import DEFAULT_CONTEXT_DESCRIPTION
910

1011
from .test_utils.client import create_test_client
1112
from .test_utils.todo_server import create_todo_server
@@ -40,7 +41,7 @@ async def test_context_parameter_injection_enabled(self):
4041
assert context_schema["type"] == "string"
4142
assert (
4243
context_schema["description"]
43-
== "Describe why you are calling this tool and how it fits into your overall task"
44+
== DEFAULT_CONTEXT_DESCRIPTION
4445
)
4546

4647
@pytest.mark.asyncio
@@ -319,7 +320,7 @@ def tool_with_context(context: str, data: str):
319320
desc = context_schema.get("description", "")
320321
if (
321322
desc
322-
== "Describe why you are calling this tool and how it fits into your overall task"
323+
== DEFAULT_CONTEXT_DESCRIPTION
323324
):
324325
# Our description was added - this means the implementation overwrote it
325326
# This happens because the check is at the property level not parameter level
@@ -705,7 +706,7 @@ async def test_default_context_description(self):
705706
# Check for default description
706707
add_todo_tool = next(t for t in tools_result.tools if t.name == "add_todo")
707708
context_schema = add_todo_tool.inputSchema["properties"]["context"]
708-
assert context_schema["description"] == "Describe why you are calling this tool and how it fits into your overall task"
709+
assert context_schema["description"] == DEFAULT_CONTEXT_DESCRIPTION
709710

710711
@pytest.mark.asyncio
711712
async def test_custom_context_description_with_multiple_tools(self):

0 commit comments

Comments
 (0)