Skip to content
Merged
Changes from 1 commit
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
17 changes: 11 additions & 6 deletions examples/usecases/mcp_basic_slack_agent/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
app = MCPApp(name="mcp_basic_agent")


async def example_usage():
@app.tool
async def fetch_latest_slack_message() -> str:
"""Get the latest message from general channel and provide a summary."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring references the "general" channel, but the implementation on line 36 is fetching from the "bot-commits" channel. For consistency, please update the docstring to match the actual implementation:

"""Get the latest message from bot-commits channel and provide a summary."""

This will ensure the documentation accurately reflects the code's behavior.

Suggested change
"""Get the latest message from general channel and provide a summary."""
"""Get the latest message from bot-commits channel and provide a summary."""

Spotted by Diamond

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

async with app.run() as agent_app:
logger = agent_app.logger
context = agent_app.context
Expand All @@ -31,22 +33,25 @@ async def example_usage():

llm = await slack_agent.attach_llm(OpenAIAugmentedLLM)
result = await llm.generate_str(
message="What was the last message in the general channel?",
message="What was the latest message in the bot-commits channel?",
)
logger.info(f"Result: {result}")

# Multi-turn conversations
result = await llm.generate_str(
message="Summarize it for me so I can understand it better.",
summary = await llm.generate_str(
message="Can you summarize what that commit was about?",
)
logger.info(f"Result: {result}")
logger.info(f"Result: {summary}")

final_result = f"Latest message: {result}\n\nSummary: {summary}"
return final_result


if __name__ == "__main__":
import time

start = time.time()
asyncio.run(example_usage())
asyncio.run(fetch_latest_slack_message())
end = time.time()
t = end - start

Expand Down
Loading