golf-mcp 0.1.20__py3-none-any.whl → 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of golf-mcp might be problematic. Click here for more details.
- golf/__init__.py +9 -1
- golf/_endpoints.py +6 -0
- golf/_endpoints_fallback.py +10 -0
- golf/auth/__init__.py +235 -83
- golf/auth/api_key.py +6 -14
- golf/auth/factory.py +358 -0
- golf/auth/helpers.py +12 -42
- golf/auth/providers.py +446 -0
- golf/auth/registry.py +256 -0
- golf/cli/branding.py +192 -0
- golf/cli/main.py +28 -69
- golf/commands/__init__.py +2 -0
- golf/commands/build.py +4 -7
- golf/commands/init.py +30 -53
- golf/commands/run.py +50 -20
- golf/core/builder.py +355 -414
- golf/core/builder_auth.py +63 -144
- golf/core/builder_telemetry.py +26 -3
- golf/core/config.py +38 -59
- golf/core/parser.py +132 -139
- golf/core/platform.py +12 -10
- golf/core/telemetry.py +11 -19
- golf/core/transformer.py +38 -15
- golf/examples/__pycache__/__init__.cpython-311.pyc +0 -0
- golf/examples/basic/.coverage +0 -0
- golf/examples/basic/.env.example +8 -4
- golf/examples/basic/README.md +117 -45
- golf/examples/basic/__pycache__/auth.cpython-311.pyc +0 -0
- golf/examples/basic/auth.py +76 -0
- golf/examples/basic/golf.json +2 -5
- golf/examples/basic/htmlcov/.gitignore +2 -0
- golf/examples/basic/htmlcov/class_index.html +547 -0
- golf/examples/basic/htmlcov/coverage_html_cb_6fb7b396.js +733 -0
- golf/examples/basic/htmlcov/favicon_32_cb_58284776.png +0 -0
- golf/examples/basic/htmlcov/function_index.html +2091 -0
- golf/examples/basic/htmlcov/index.html +349 -0
- golf/examples/basic/htmlcov/keybd_closed_cb_ce680311.png +0 -0
- golf/examples/basic/htmlcov/status.json +1 -0
- golf/examples/basic/htmlcov/style_cb_8e611ae1.css +337 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496___init___py.html +323 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_api_key_py.html +170 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_factory_py.html +430 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_helpers_py.html +288 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_providers_py.html +493 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_registry_py.html +353 -0
- golf/examples/basic/htmlcov/z_3ec3b3f490dc0950___init___py.html +120 -0
- golf/examples/basic/htmlcov/z_3ec3b3f490dc0950_instrumentation_py.html +1535 -0
- golf/examples/basic/htmlcov/z_4b8b9dd4ccccc5db___init___py.html +98 -0
- golf/examples/basic/htmlcov/z_4b8b9dd4ccccc5db_branding_py.html +289 -0
- golf/examples/basic/htmlcov/z_4b8b9dd4ccccc5db_main_py.html +476 -0
- golf/examples/basic/htmlcov/z_5a6c4e6bcc86fb2f___init___py.html +97 -0
- golf/examples/basic/htmlcov/z_6cadab9ec0df475d___init___py.html +102 -0
- golf/examples/basic/htmlcov/z_6cadab9ec0df475d_build_py.html +178 -0
- golf/examples/basic/htmlcov/z_6cadab9ec0df475d_init_py.html +387 -0
- golf/examples/basic/htmlcov/z_6cadab9ec0df475d_run_py.html +222 -0
- golf/examples/basic/htmlcov/z_6fcdee0582ba84e4___init___py.html +106 -0
- golf/examples/basic/htmlcov/z_6fcdee0582ba84e4__endpoints_fallback_py.html +107 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217___init___py.html +98 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_builder_auth_py.html +306 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_builder_metrics_py.html +329 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_builder_py.html +1471 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_builder_telemetry_py.html +186 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_config_py.html +315 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_parser_py.html +1149 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_platform_py.html +279 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_telemetry_py.html +589 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_transformer_py.html +286 -0
- golf/examples/basic/htmlcov/z_7d7da37693a43688___init___py.html +107 -0
- golf/examples/basic/htmlcov/z_7d7da37693a43688_collector_py.html +417 -0
- golf/examples/basic/htmlcov/z_7d7da37693a43688_registry_py.html +109 -0
- golf/examples/basic/htmlcov/z_abe733142b40ad4e___init___py.html +109 -0
- golf/examples/basic/htmlcov/z_abe733142b40ad4e_context_py.html +150 -0
- golf/examples/basic/htmlcov/z_abe733142b40ad4e_elicitation_py.html +267 -0
- golf/examples/basic/htmlcov/z_abe733142b40ad4e_sampling_py.html +318 -0
- golf/examples/basic/prompts/__pycache__/welcome.cpython-311.pyc +0 -0
- golf/examples/basic/prompts/welcome.py +3 -5
- golf/examples/basic/resources/__pycache__/current_time.cpython-311.pyc +0 -0
- golf/examples/basic/resources/__pycache__/info.cpython-311.pyc +0 -0
- golf/examples/basic/resources/current_time.py +5 -13
- golf/examples/basic/resources/weather/__pycache__/common.cpython-311.pyc +0 -0
- golf/examples/basic/resources/weather/__pycache__/current.cpython-311.pyc +0 -0
- golf/examples/basic/resources/weather/__pycache__/forecast.cpython-311.pyc +0 -0
- golf/examples/basic/resources/weather/city.py +46 -0
- golf/examples/basic/resources/weather/common.py +4 -11
- golf/examples/basic/resources/weather/current.py +5 -5
- golf/examples/basic/resources/weather/forecast.py +5 -5
- golf/examples/basic/tools/__pycache__/calculator.cpython-311.pyc +0 -0
- golf/examples/basic/tools/calculator.py +94 -0
- golf/examples/basic/tools/say/__pycache__/hello.cpython-311.pyc +0 -0
- golf/examples/basic/tools/say/hello.py +65 -0
- golf/metrics/collector.py +100 -19
- golf/telemetry/__init__.py +4 -0
- golf/telemetry/instrumentation.py +484 -178
- golf/utilities/__init__.py +12 -0
- golf/utilities/context.py +53 -0
- golf/utilities/elicitation.py +170 -0
- golf/utilities/sampling.py +221 -0
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.1.dist-info}/METADATA +51 -104
- golf_mcp-0.2.1.dist-info/RECORD +110 -0
- golf/auth/oauth.py +0 -861
- golf/auth/provider.py +0 -115
- golf/examples/api_key/.env +0 -2
- golf/examples/api_key/.env.example +0 -1
- golf/examples/api_key/README.md +0 -84
- golf/examples/api_key/golf.json +0 -8
- golf/examples/api_key/pre_build.py +0 -11
- golf/examples/api_key/tools/issues/create.py +0 -93
- golf/examples/api_key/tools/issues/list.py +0 -92
- golf/examples/api_key/tools/repos/list.py +0 -111
- golf/examples/api_key/tools/search/code.py +0 -106
- golf/examples/api_key/tools/users/get.py +0 -82
- golf/examples/basic/.env +0 -5
- golf/examples/basic/pre_build.py +0 -28
- golf/examples/basic/tools/github_user.py +0 -65
- golf/examples/basic/tools/hello.py +0 -34
- golf/examples/basic/tools/payments/charge.py +0 -70
- golf/examples/basic/tools/payments/common.py +0 -36
- golf/examples/basic/tools/payments/refund.py +0 -61
- golf_mcp-0.1.20.dist-info/RECORD +0 -60
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.1.dist-info}/WHEEL +0 -0
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.1.dist-info}/entry_points.txt +0 -0
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.1.dist-info}/licenses/LICENSE +0 -0
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.1.dist-info}/top_level.txt +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"""Get GitHub user information."""
|
|
2
|
-
|
|
3
|
-
from typing import Annotated, Any
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
from pydantic import BaseModel, Field
|
|
7
|
-
|
|
8
|
-
from golf.auth import get_api_key
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Output(BaseModel):
|
|
12
|
-
"""User information result."""
|
|
13
|
-
|
|
14
|
-
found: bool
|
|
15
|
-
user: dict[str, Any] | None = None
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
async def get(
|
|
19
|
-
username: Annotated[
|
|
20
|
-
str | None,
|
|
21
|
-
Field(description="GitHub username (if not provided, gets authenticated user)"),
|
|
22
|
-
] = None,
|
|
23
|
-
) -> Output:
|
|
24
|
-
"""Get information about a GitHub user.
|
|
25
|
-
|
|
26
|
-
If no username is provided, returns information about the authenticated user.
|
|
27
|
-
This is useful for testing if authentication is working correctly.
|
|
28
|
-
"""
|
|
29
|
-
github_token = get_api_key()
|
|
30
|
-
|
|
31
|
-
# Determine the API endpoint
|
|
32
|
-
if username:
|
|
33
|
-
url = f"https://api.github.com/users/{username}"
|
|
34
|
-
else:
|
|
35
|
-
# Get authenticated user - requires token
|
|
36
|
-
if not github_token:
|
|
37
|
-
return Output(found=False)
|
|
38
|
-
url = "https://api.github.com/user"
|
|
39
|
-
|
|
40
|
-
# Prepare headers
|
|
41
|
-
headers = {
|
|
42
|
-
"Accept": "application/vnd.github.v3+json",
|
|
43
|
-
"User-Agent": "Golf-GitHub-MCP-Server",
|
|
44
|
-
}
|
|
45
|
-
if github_token:
|
|
46
|
-
headers["Authorization"] = f"Bearer {github_token}"
|
|
47
|
-
|
|
48
|
-
try:
|
|
49
|
-
async with httpx.AsyncClient() as client:
|
|
50
|
-
response = await client.get(url, headers=headers, timeout=10.0)
|
|
51
|
-
|
|
52
|
-
response.raise_for_status()
|
|
53
|
-
user_data = response.json()
|
|
54
|
-
|
|
55
|
-
return Output(
|
|
56
|
-
found=True,
|
|
57
|
-
user={
|
|
58
|
-
"login": user_data["login"],
|
|
59
|
-
"name": user_data.get("name", ""),
|
|
60
|
-
"email": user_data.get("email", ""),
|
|
61
|
-
"bio": user_data.get("bio", ""),
|
|
62
|
-
"company": user_data.get("company", ""),
|
|
63
|
-
"location": user_data.get("location", ""),
|
|
64
|
-
"public_repos": user_data.get("public_repos", 0),
|
|
65
|
-
"followers": user_data.get("followers", 0),
|
|
66
|
-
"following": user_data.get("following", 0),
|
|
67
|
-
"created_at": user_data["created_at"],
|
|
68
|
-
"url": user_data["html_url"],
|
|
69
|
-
},
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
except httpx.HTTPStatusError as e:
|
|
73
|
-
if e.response.status_code in [401, 404]:
|
|
74
|
-
return Output(found=False)
|
|
75
|
-
else:
|
|
76
|
-
return Output(found=False)
|
|
77
|
-
except Exception:
|
|
78
|
-
return Output(found=False)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# Export the function to be used as the tool
|
|
82
|
-
export = get
|
golf/examples/basic/.env
DELETED
golf/examples/basic/pre_build.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"""Pre-build configuration for the basic example.
|
|
2
|
-
|
|
3
|
-
This file is executed before the build process starts.
|
|
4
|
-
It configures GitHub OAuth authentication for the example.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from golf.auth import ProviderConfig, configure_auth
|
|
8
|
-
|
|
9
|
-
# Create GitHub OAuth provider configuration
|
|
10
|
-
github_provider = ProviderConfig(
|
|
11
|
-
provider="github",
|
|
12
|
-
client_id_env_var="GITHUB_CLIENT_ID",
|
|
13
|
-
client_secret_env_var="GITHUB_CLIENT_SECRET",
|
|
14
|
-
jwt_secret_env_var="JWT_SECRET",
|
|
15
|
-
authorize_url="https://github.com/login/oauth/authorize",
|
|
16
|
-
token_url="https://github.com/login/oauth/access_token",
|
|
17
|
-
userinfo_url="https://api.github.com/user",
|
|
18
|
-
scopes=["read:user", "user:email"],
|
|
19
|
-
issuer_url="http://127.0.0.1:3000", # This should be your Golf server's accessible URL
|
|
20
|
-
callback_path="/auth/callback", # Golf's callback path
|
|
21
|
-
token_expiration=3600, # 1 hour
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
# Configure authentication with the provider
|
|
25
|
-
configure_auth(
|
|
26
|
-
provider=github_provider,
|
|
27
|
-
required_scopes=["read:user"], # Require read:user scope for protected endpoints
|
|
28
|
-
)
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"""Tool for fetching GitHub user information."""
|
|
2
|
-
|
|
3
|
-
import httpx
|
|
4
|
-
from pydantic import BaseModel
|
|
5
|
-
|
|
6
|
-
from golf.auth import get_provider_token
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class GitHubUserResponse(BaseModel):
|
|
10
|
-
"""Response model for GitHub user information."""
|
|
11
|
-
|
|
12
|
-
login: str
|
|
13
|
-
id: int
|
|
14
|
-
name: str | None = None
|
|
15
|
-
email: str | None = None
|
|
16
|
-
avatar_url: str | None = None
|
|
17
|
-
location: str | None = None
|
|
18
|
-
bio: str | None = None
|
|
19
|
-
public_repos: int = 0
|
|
20
|
-
followers: int = 0
|
|
21
|
-
following: int = 0
|
|
22
|
-
message: str | None = None
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
async def get_github_user() -> GitHubUserResponse:
|
|
26
|
-
"""Fetch authenticated user's GitHub profile information."""
|
|
27
|
-
try:
|
|
28
|
-
# Get GitHub token using our abstraction
|
|
29
|
-
github_token = get_provider_token()
|
|
30
|
-
|
|
31
|
-
if not github_token:
|
|
32
|
-
return GitHubUserResponse(
|
|
33
|
-
login="anonymous",
|
|
34
|
-
id=0,
|
|
35
|
-
message="Not authenticated. Please login first.",
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
# Call GitHub API to get user info
|
|
39
|
-
async with httpx.AsyncClient() as client:
|
|
40
|
-
response = await client.get(
|
|
41
|
-
"https://api.github.com/user",
|
|
42
|
-
headers={
|
|
43
|
-
"Authorization": f"Bearer {github_token}",
|
|
44
|
-
"Accept": "application/vnd.github.v3+json",
|
|
45
|
-
},
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
if response.status_code == 200:
|
|
49
|
-
data = response.json()
|
|
50
|
-
return GitHubUserResponse(**data)
|
|
51
|
-
else:
|
|
52
|
-
return GitHubUserResponse(
|
|
53
|
-
login="error",
|
|
54
|
-
id=0,
|
|
55
|
-
message=f"GitHub API error: {response.status_code} - {response.text[:100]}",
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
except Exception as e:
|
|
59
|
-
return GitHubUserResponse(
|
|
60
|
-
login="error", id=0, message=f"Error fetching GitHub data: {str(e)}"
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# Export the tool
|
|
65
|
-
export = get_github_user
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"""Hello World tool {{project_name}}."""
|
|
2
|
-
|
|
3
|
-
from typing import Annotated
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Output(BaseModel):
|
|
9
|
-
"""Response from the hello tool."""
|
|
10
|
-
|
|
11
|
-
message: str
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
async def hello(
|
|
15
|
-
name: Annotated[
|
|
16
|
-
str, Field(description="The name of the person to greet")
|
|
17
|
-
] = "World",
|
|
18
|
-
greeting: Annotated[str, Field(description="The greeting phrase to use")] = "Hello",
|
|
19
|
-
) -> Output:
|
|
20
|
-
"""Say hello to the given name.
|
|
21
|
-
|
|
22
|
-
This is a simple example tool that demonstrates the basic structure
|
|
23
|
-
of a tool implementation in GolfMCP.
|
|
24
|
-
"""
|
|
25
|
-
# The framework will add a context object automatically
|
|
26
|
-
# You can log using regular print during development
|
|
27
|
-
print(f"{greeting} {name}...")
|
|
28
|
-
|
|
29
|
-
# Create and return the response
|
|
30
|
-
return Output(message=f"{greeting}, {name}!")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# Designate the entry point function
|
|
34
|
-
export = hello
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"""Charge payment tool"""
|
|
2
|
-
|
|
3
|
-
from typing import Annotated
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
from .common import payment_client
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Output(BaseModel):
|
|
11
|
-
"""Response from the charge payment tool."""
|
|
12
|
-
|
|
13
|
-
success: bool
|
|
14
|
-
charge_id: str
|
|
15
|
-
message: str
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
async def charge(
|
|
19
|
-
amount: Annotated[
|
|
20
|
-
float,
|
|
21
|
-
Field(
|
|
22
|
-
description="Amount to charge in USD",
|
|
23
|
-
gt=0, # Must be greater than 0
|
|
24
|
-
le=10000, # Maximum charge limit
|
|
25
|
-
),
|
|
26
|
-
],
|
|
27
|
-
card_token: Annotated[
|
|
28
|
-
str,
|
|
29
|
-
Field(
|
|
30
|
-
description="Tokenized payment card identifier",
|
|
31
|
-
pattern=r"^tok_[a-zA-Z0-9]+$", # Validate token format
|
|
32
|
-
),
|
|
33
|
-
],
|
|
34
|
-
description: Annotated[
|
|
35
|
-
str,
|
|
36
|
-
Field(
|
|
37
|
-
description="Optional payment description for the charge", max_length=200
|
|
38
|
-
),
|
|
39
|
-
] = "",
|
|
40
|
-
) -> Output:
|
|
41
|
-
"""Process a payment charge.
|
|
42
|
-
|
|
43
|
-
This example demonstrates nested directory organization where related tools
|
|
44
|
-
are grouped in subdirectories (tools/payments/charge.py).
|
|
45
|
-
|
|
46
|
-
The resulting tool ID will be: charge-payments
|
|
47
|
-
|
|
48
|
-
Args:
|
|
49
|
-
amount: Amount to charge in USD
|
|
50
|
-
card_token: Tokenized payment card
|
|
51
|
-
description: Optional payment description
|
|
52
|
-
"""
|
|
53
|
-
# The framework will add a context object automatically
|
|
54
|
-
# You can log using regular print during development
|
|
55
|
-
print(f"Processing charge for ${amount:.2f}...")
|
|
56
|
-
|
|
57
|
-
# Use the shared payment client from common.py
|
|
58
|
-
charge_result = await payment_client.create_charge(
|
|
59
|
-
amount=amount, token=card_token, description=description
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
# Create and return the response
|
|
63
|
-
return Output(
|
|
64
|
-
success=True,
|
|
65
|
-
charge_id=charge_result["id"],
|
|
66
|
-
message=f"Successfully charged ${amount:.2f}",
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
export = charge
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"""Payments shared functionality.
|
|
2
|
-
|
|
3
|
-
This common.py file demonstrates the recommended pattern for
|
|
4
|
-
sharing functionality across multiple tools in a directory.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import os
|
|
8
|
-
|
|
9
|
-
# Read configuration from environment variables
|
|
10
|
-
PAYMENT_API_KEY = os.environ.get("PAYMENT_API_KEY", "mock_key")
|
|
11
|
-
PAYMENT_API_URL = os.environ.get("PAYMENT_API_URL", "https://api.example.com/payments")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class PaymentClient:
|
|
15
|
-
"""Mock payment provider client."""
|
|
16
|
-
|
|
17
|
-
def __init__(
|
|
18
|
-
self, api_key: str = PAYMENT_API_KEY, api_url: str = PAYMENT_API_URL
|
|
19
|
-
) -> None:
|
|
20
|
-
self.api_key = api_key
|
|
21
|
-
self.api_url = api_url
|
|
22
|
-
|
|
23
|
-
async def create_charge(self, amount: float, token: str, **kwargs):
|
|
24
|
-
"""Create a charge (mock implementation)."""
|
|
25
|
-
# In a real implementation, this would make an API request
|
|
26
|
-
# using the configured API key and URL
|
|
27
|
-
return {"id": f"ch_{int(amount * 100)}_{hash(token) % 10000:04d}"}
|
|
28
|
-
|
|
29
|
-
async def create_refund(self, charge_id: str, amount: float, **kwargs):
|
|
30
|
-
"""Create a refund (mock implementation)."""
|
|
31
|
-
# In a real implementation, this would make an API request
|
|
32
|
-
return {"id": f"ref_{charge_id}_{int(amount * 100)}"}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# Create a shared payment client that can be imported by all tools in this directory
|
|
36
|
-
payment_client = PaymentClient()
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"""Refund payment tool"""
|
|
2
|
-
|
|
3
|
-
from typing import Annotated
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
from .common import payment_client
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Output(BaseModel):
|
|
11
|
-
"""Response from the refund payment tool."""
|
|
12
|
-
|
|
13
|
-
success: bool
|
|
14
|
-
refund_id: str
|
|
15
|
-
message: str
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
async def refund(
|
|
19
|
-
charge_id: Annotated[
|
|
20
|
-
str,
|
|
21
|
-
Field(
|
|
22
|
-
description="The ID of the charge to refund", pattern=r"^ch_[a-zA-Z0-9]+$"
|
|
23
|
-
),
|
|
24
|
-
],
|
|
25
|
-
amount: Annotated[
|
|
26
|
-
float | None,
|
|
27
|
-
Field(
|
|
28
|
-
description="Amount to refund in USD. If not specified, refunds the full charge amount",
|
|
29
|
-
gt=0,
|
|
30
|
-
default=None,
|
|
31
|
-
),
|
|
32
|
-
] = None,
|
|
33
|
-
reason: Annotated[
|
|
34
|
-
str, Field(description="Reason for the refund", min_length=3, max_length=200)
|
|
35
|
-
] = "Customer request",
|
|
36
|
-
) -> Output:
|
|
37
|
-
"""Process a payment refund.
|
|
38
|
-
|
|
39
|
-
This example demonstrates nested directory organization where related tools
|
|
40
|
-
are grouped in subdirectories (tools/payments/refund.py).
|
|
41
|
-
|
|
42
|
-
The resulting tool ID will be: refund-payments
|
|
43
|
-
"""
|
|
44
|
-
# The framework will add a context object automatically
|
|
45
|
-
# You can log using regular print during development
|
|
46
|
-
print(f"Processing refund for charge {charge_id}...")
|
|
47
|
-
|
|
48
|
-
# Use the shared payment client from common.py
|
|
49
|
-
refund_result = await payment_client.create_refund(
|
|
50
|
-
charge_id=charge_id, amount=amount, reason=reason
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
# Create and return the response
|
|
54
|
-
return Output(
|
|
55
|
-
success=True,
|
|
56
|
-
refund_id=refund_result["id"],
|
|
57
|
-
message=f"Successfully refunded charge {charge_id}",
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export = refund
|
golf_mcp-0.1.20.dist-info/RECORD
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
golf/__init__.py,sha256=8XalsVoLEfXslFvdtUEmkNOuYShzOzYOcFbgmOz1oSk,23
|
|
2
|
-
golf/auth/__init__.py,sha256=Rj4yUngJklk6xrDCrxqLTtoDAMzF1HcTvy_l8wREeao,4103
|
|
3
|
-
golf/auth/api_key.py,sha256=LiIraLiH2v7s3yavidaI6BDlAEfK8XnWF15QmaJn9G4,2378
|
|
4
|
-
golf/auth/helpers.py,sha256=ZogdcHM7J2PN6cL6F6OLZ3gyoUR3dwAFDxOJQ2DW_bc,6526
|
|
5
|
-
golf/auth/oauth.py,sha256=-TYcMA4ULWNQacmUvzek2uQVMJpRT3hXC_d5D2k9c44,31156
|
|
6
|
-
golf/auth/provider.py,sha256=3loeYrkNwIRDvyUkf8gbcCRJSiKiVXgE_rMGCSCr5mk,3802
|
|
7
|
-
golf/cli/__init__.py,sha256=R8Y8KdD2C8gDo24fXGq-fdWWNeaq3MYjrbaSB8Hb-Hg,45
|
|
8
|
-
golf/cli/main.py,sha256=3qexjKNL8vYg-48ATYcwW4-Wv45l3VxntW-mSqDAbEc,13958
|
|
9
|
-
golf/commands/__init__.py,sha256=GKtIEm7EPQWRgot73RPZPWegwN7Zm0bHtUJbR63FNiw,83
|
|
10
|
-
golf/commands/build.py,sha256=jhdxB5EwwCC_8PgqdXLUKuBpnycjh0gft3_7EuTo6ro,2319
|
|
11
|
-
golf/commands/init.py,sha256=DUAvGqOUapWdF2cgWPscqHRvyOZDiajR0F0Wkn_jm-k,10355
|
|
12
|
-
golf/commands/run.py,sha256=xsiG5LZw4qVt3cRTTfIoWP4Bf4AxNBBJKx0NNfoua40,2884
|
|
13
|
-
golf/core/__init__.py,sha256=4bKeskJ2fPaZqkz2xQScSa3phRLLrmrczwSL632jv-o,52
|
|
14
|
-
golf/core/builder.py,sha256=06BccMHR6BFMsdyL-3YJJFqLHVLE-NYSQriVyPFzL6s,59657
|
|
15
|
-
golf/core/builder_auth.py,sha256=nGgyMTiRAqaNfh1FSvoFe6oTVq9RgfMf9JoFGAv2_do,14050
|
|
16
|
-
golf/core/builder_metrics.py,sha256=j6Gtgd867o46JbDfSNGNsHt1QtV1XHKUJs1z8r4siQM,8830
|
|
17
|
-
golf/core/builder_telemetry.py,sha256=jobFgRSspLQLuitL4ytk6asSUdTqYcDxGY3sTjkrZd4,2654
|
|
18
|
-
golf/core/config.py,sha256=6yPtwzVTJauufEnrfUbxsz69H8jC0Ra427oDaRM0-xE,7397
|
|
19
|
-
golf/core/parser.py,sha256=BQRus1O9zmzSmyavwLVfN8BpYFkbrWUDrgQ7yrYfAKw,42457
|
|
20
|
-
golf/core/platform.py,sha256=y8-yhRPfvm-Eu44p_kN9wg74n1kB2HweRgRYy-Gu1c4,6473
|
|
21
|
-
golf/core/telemetry.py,sha256=CjZ7urbizaRjyFiVBjfGW8V4PmNCG1_quk3FvbVTcjw,15772
|
|
22
|
-
golf/core/transformer.py,sha256=_0nM42M41oM9zw_XxPVVS6MErdBSw2B5lULC7_UFLfU,5287
|
|
23
|
-
golf/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
golf/examples/api_key/.env,sha256=15dewTdeJEMAIuzQmh1SFc1zEN6PwryWgAc14IV02lY,90
|
|
25
|
-
golf/examples/api_key/.env.example,sha256=fvM_r9xLoiJ_41ZbcDc_EQ48uyxwb7zf0gP_bhQroEY,29
|
|
26
|
-
golf/examples/api_key/README.md,sha256=wRcgwYArwiRcjL6GKEOkPVQal7L37WnREa_rwhrIE10,2892
|
|
27
|
-
golf/examples/api_key/golf.json,sha256=V7atsB5T706bBlkZ5iVBPIhAA6_3Ba3dN6NOyVaV06g,214
|
|
28
|
-
golf/examples/api_key/pre_build.py,sha256=-12HGLV70sQcPhgN51zx25uN2o48JeFvTByzF2ayYp4,471
|
|
29
|
-
golf/examples/api_key/tools/issues/create.py,sha256=51X0uGaisUMfMkmJCskArpefpnxZ4fnT4T_f7HhqQdU,2721
|
|
30
|
-
golf/examples/api_key/tools/issues/list.py,sha256=Egl2o1YVSU8Iigu8XO_iK1-Pn1OnFL3j6LOzaG10rTI,2720
|
|
31
|
-
golf/examples/api_key/tools/repos/list.py,sha256=9JTRLFzA7GwMYAaLjpOD85uXxv0JI4HdV1gEkLVuVKE,3410
|
|
32
|
-
golf/examples/api_key/tools/search/code.py,sha256=3quEIzrl0i_DM1fjszTcrzaAqMC7p0TZY99NL5GceKY,2993
|
|
33
|
-
golf/examples/api_key/tools/users/get.py,sha256=VF-hdUkba2_DqKSC_F7vqtbx0EXAK06wUFBEluKqLIA,2470
|
|
34
|
-
golf/examples/basic/.env,sha256=CqdcvPXopWppurJ3bBjT2dODlKUrLv629BHnOy8zBkM,247
|
|
35
|
-
golf/examples/basic/.env.example,sha256=fqMyaQ7pc9KHFcT4vChBO4AEGrbW7PVXOfqbrCO6j9Q,157
|
|
36
|
-
golf/examples/basic/README.md,sha256=-mY3R6AAnkXT9FPkALDrJtdf9IyKDvuqjsrLAMTLRYI,2663
|
|
37
|
-
golf/examples/basic/golf.json,sha256=8DiRIXmWolrILmbHzEG2tK-ZVwu1W2qBXRLz75XEjAs,166
|
|
38
|
-
golf/examples/basic/pre_build.py,sha256=AG1N_sKd1UUtHPL7sw1v3YGOcZPQvoa9xcL79S9qjGI,1037
|
|
39
|
-
golf/examples/basic/prompts/welcome.py,sha256=Qs_OsXdyPNw_cDZU7cnG4a0ZMzka6LF7vmPfax4cmKM,790
|
|
40
|
-
golf/examples/basic/resources/current_time.py,sha256=hxhV7vGoiOv-DMXVNSVax_jkPoYR3CR9q5PpWYkdliI,1157
|
|
41
|
-
golf/examples/basic/resources/info.py,sha256=LxHzg_TmwonSu1vSkuNcpUq5JrBu-9yzoGaARE1f2KU,727
|
|
42
|
-
golf/examples/basic/resources/weather/common.py,sha256=8Nu_hQJZxlWRjwBDG1fmai5l0E5g0UWg2j076_f1eYk,1804
|
|
43
|
-
golf/examples/basic/resources/weather/current.py,sha256=Y0LfMu7eBDwDDcNBuWBN8GgzoflekQraYMjg_DZgwLk,958
|
|
44
|
-
golf/examples/basic/resources/weather/forecast.py,sha256=ClofuMB9GFMz1EfCEQddYcv2Ca90xeVYR8BKYCmB1HE,1015
|
|
45
|
-
golf/examples/basic/tools/github_user.py,sha256=cAlXNkViR0XRc1cjLJgZ44KuAiN7DHQug-HJX3Zi2sw,1874
|
|
46
|
-
golf/examples/basic/tools/hello.py,sha256=s7Soiq9Wn7oKIvA6Hid8UKB14iyR7HZppIbIT4g80Mc,872
|
|
47
|
-
golf/examples/basic/tools/payments/charge.py,sha256=PIYdFV90hu35H1veLI8ueuYwebzrr5SCTX-x6lxRmU4,1800
|
|
48
|
-
golf/examples/basic/tools/payments/common.py,sha256=hfyuQRIjrQfSqGjyY55W6pZSD5jL6O0geCE0DGx0v10,1302
|
|
49
|
-
golf/examples/basic/tools/payments/refund.py,sha256=Qpl4GWvUw-L06oGQMbBzG8pikfCWfBCFcpkRiDOzmyQ,1607
|
|
50
|
-
golf/metrics/__init__.py,sha256=O91y-hj_E9R06gqV8pDZrzHxOIl-1T415Hj9RvFAp3o,283
|
|
51
|
-
golf/metrics/collector.py,sha256=iyRszP8TAAigyOsUFTGdKN8Xeob36LhUvXW9tntJrbA,7617
|
|
52
|
-
golf/metrics/registry.py,sha256=mXQE4Pwf3PopGYjcUu4eGgPDAe085YWcsvcvWk0ny8Q,310
|
|
53
|
-
golf/telemetry/__init__.py,sha256=ESGCg5HKwTCIfID1e_K7EE0bOWkSzMidlLtdqQgBd0w,396
|
|
54
|
-
golf/telemetry/instrumentation.py,sha256=t0iuoIuY3mmtcdNAlUvbUgUfpRkH0mZoYg2C6qm8g2s,45320
|
|
55
|
-
golf_mcp-0.1.20.dist-info/licenses/LICENSE,sha256=5_j2f6fTJmvfmUewzElhkpAaXg2grVoxKouOA8ihV6E,11348
|
|
56
|
-
golf_mcp-0.1.20.dist-info/METADATA,sha256=erjB5udWAGp_OQa3MiPhwbpi0R7zZAJeTMpSqnl67Rg,12820
|
|
57
|
-
golf_mcp-0.1.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
58
|
-
golf_mcp-0.1.20.dist-info/entry_points.txt,sha256=5y7rHYM8jGpU-nfwdknCm5XsApLulqsnA37MO6BUTYg,43
|
|
59
|
-
golf_mcp-0.1.20.dist-info/top_level.txt,sha256=BQToHcBUufdyhp9ONGMIvPE40jMEtmI20lYaKb4hxOg,5
|
|
60
|
-
golf_mcp-0.1.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|