Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/greyhaven-ai/sygaldryWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/greyhaven-ai/sygaldry/mirascope-agent-tool-creation)<a href="https://agentmods.dev/rules/greyhaven-ai/sygaldry/mirascope-agent-tool-creation"><img src="https://agentmods.dev/badge/rules/greyhaven-ai/sygaldry/mirascope-agent-tool-creation/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/greyhaven-ai/sygaldry/mirascope-agent-tool-creation"><img src="https://agentmods.dev/badge/rules/greyhaven-ai/sygaldry/mirascope-agent-tool-creation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.00603 |
| Opus 5 | $0.00000 | $0.00302 |
| Sonnet 5 | $0.00000 | $0.00121 |
| Haiku 4.5 | $0.00000 | $0.00060 |
Grade A, and why
mirascope-agent-tool-creation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 76 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Mirascope Agent and Tool Creation
When developing agents and tools using the Mirascope library, please adhere to the following best practices to ensure consistency and maintainability across the codebase.
Prefer Functions Over Classes
For both agents and tools, prefer implementing them as functions rather than classes whenever possible. This approach often leads to simpler, more stateless components that are easier to test and reason about.
Example: Defining a Tool as a Function
from mirascope import llm
def get_current_weather(location: str) -> str:
"""
Fetches the current weather for a given location.
Args:
location: The city and state, e.g., "San Francisco, CA"
Returns:
A string describing the current weather.
"""
# Implementation to fetch weather data...
return f"The weather in {location} is sunny."
@llm.call(provider="openai", model="gpt-4o-mini", tools=[get_current_weather])
def weather_assistant(question: str):
return question
# response = weather_assistant("What's the weather like in London?")
# if response.tool:
# output = response.tool.call()
# print(output)
Use Generic LLM Call Decorator
Instead of using provider-specific decorators like @openai.call or @anthropic.call, use the generic @llm.call decorator. This allows for greater flexibility in switching between LLM providers and models without significant code changes.
Specify the provider and model arguments directly in the @llm.call decorator.
Correct Usage:
from mirascope.core import llm, prompt_template
@llm.call(provider="openai", model="gpt-4o-mini")
@prompt_template("Recommend a {genre} book.")
def recommend_book(genre: str):
...
# book_recommendation = recommend_book("science fiction")
# print(book_recommendation.content)
Incorrect Usage (Avoid provider-specific decorators):
# from mirascope.core import openai # Avoid this
# @openai.call(model="gpt-4o-mini") # Avoid this
# @prompt_template("Recommend a {genre} book.")
# def recommend_book(genre: str):
# ...
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 10d ago First seen · 76 lines · 0 tokens per session scan A 16bb2a0a3610
mirascope-agent-tool-creation is a cursor rule published in the GitHub repository greyhaven-ai/sygaldry (11 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 603 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
python_tests
We use the unit tests to cover internal behavior that can work without the web / backend counterpart. We aim for 95%+ unit test coverage of our Python code in lib/streamlit.
python-llm-ml-workflow-cursorrules-prompt-file
Cursor rules for Python LLM & ML development with workflow integration.
python
Python best practices and patterns for modern software development with Flask and SQLite.
python-containerization-cursorrules-prompt-file
Cursor rules for Python development with containerization integration.
django
Definitive guidelines for writing maintainable, performant, and secure Django applications, emphasizing modern best practices, clear code organization, and efficient patterns.
rich
Definitive guidelines for building robust, maintainable, and visually appealing Python CLI applications using the rich library.