Skip to content

Commit 977b352

Browse files
authored
Merge branch 'main' into weather-server-rust
2 parents fb55618 + a9e5cf7 commit 977b352

File tree

4 files changed

+59
-8
lines changed

4 files changed

+59
-8
lines changed

.github/workflows/claude.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
actions: read # Required for Claude to read CI results on PRs
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Run Claude Code
34+
id: claude
35+
uses: anthropics/claude-code-action@v1
36+
with:
37+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
38+
39+
# This is an optional setting that allows Claude to read CI results on PRs
40+
additional_permissions: |
41+
actions: read
42+
43+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44+
# prompt: 'Update the pull request description to include a summary of changes.'
45+
46+
# Optional: Add claude_args to customize behavior and configuration
47+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48+
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
49+
# claude_args: '--allowed-tools Bash(gh pr:*)'
50+

mcp-client-python/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async def process_query(self, query: str) -> str:
6464

6565
# Initial Claude API call
6666
response = self.anthropic.messages.create(
67-
model="claude-3-5-sonnet-20241022",
67+
model="claude-sonnet-4-0",
6868
max_tokens=1000,
6969
messages=messages,
7070
tools=available_tools
@@ -97,7 +97,7 @@ async def process_query(self, query: str) -> str:
9797

9898
# Get next response from Claude
9999
response = self.anthropic.messages.create(
100-
model="claude-3-5-sonnet-20241022",
100+
model="claude-sonnet-4-0",
101101
max_tokens=1000,
102102
messages=messages,
103103
)

mcp-client-typescript/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,14 @@ class MCPClient {
9292

9393
// Initial Claude API call
9494
const response = await this.anthropic.messages.create({
95-
model: "claude-3-5-sonnet-20241022",
95+
model: "claude-sonnet-4-0",
9696
max_tokens: 1000,
9797
messages,
9898
tools: this.tools,
9999
});
100100

101101
// Process response and handle tool calls
102102
const finalText = [];
103-
const toolResults = [];
104103

105104
for (const content of response.content) {
106105
if (content.type === "text") {
@@ -114,7 +113,6 @@ class MCPClient {
114113
name: toolName,
115114
arguments: toolArgs,
116115
});
117-
toolResults.push(result);
118116
finalText.push(
119117
`[Calling tool ${toolName} with args ${JSON.stringify(toolArgs)}]`,
120118
);
@@ -127,7 +125,7 @@ class MCPClient {
127125

128126
// Get next response from Claude
129127
const response = await this.anthropic.messages.create({
130-
model: "claude-3-5-sonnet-20241022",
128+
model: "claude-sonnet-4-0",
131129
max_tokens: 1000,
132130
messages,
133131
});

weather-server-python/weather.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ async def get_forecast(latitude: float, longitude: float) -> str:
8989

9090
return "\n---\n".join(forecasts)
9191

92-
if __name__ == "__main__":
92+
def main():
9393
# Initialize and run the server
94-
mcp.run(transport='stdio')
94+
mcp.run(transport='stdio')
95+
96+
if __name__ == "__main__":
97+
main()

0 commit comments

Comments
 (0)