Skip to content

Commit 713eb6c

Browse files
claude[bot]olaservo
andcommitted
fix: align everything server resource URI numbering with array indices
Fixes issue where array indices (0-based) didn't match URI numbers (1-based), causing confusion where: - Resource at index 0 was accessed via 'test://static/resource/1' - Even indices (text resources) mapped to odd URI numbers Changes: - Resource URIs now use 0-based numbering to match array indices - Resource 0 is now accessed via 'test://static/resource/0' - Even indices now map to even URI numbers (more intuitive) Resolves #475 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Ola Hungerford <olaservo@users.noreply.github.com>
1 parent fcb550e commit 713eb6c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/everything/everything.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export const createServer = () => {
254254
};
255255

256256
const ALL_RESOURCES: Resource[] = Array.from({ length: 100 }, (_, i) => {
257-
const uri = `test://static/resource/${i + 1}`;
257+
const uri = `test://static/resource/${i}`;
258258
if (i % 2 === 0) {
259259
return {
260260
uri,
@@ -316,7 +316,7 @@ export const createServer = () => {
316316
const uri = request.params.uri;
317317

318318
if (uri.startsWith("test://static/resource/")) {
319-
const index = parseInt(uri.split("/").pop() ?? "", 10) - 1;
319+
const index = parseInt(uri.split("/").pop() ?? "", 10);
320320
if (index >= 0 && index < ALL_RESOURCES.length) {
321321
const resource = ALL_RESOURCES[index];
322322
return {

0 commit comments

Comments
 (0)